private void AssertWithHeader(string full, string expected, EmptyVisitor visitor) { var syntax = new Parser(Tokenizer.Create()).Parse(full); var semantic = new Semantic.SemanticAnalyzer().Analize(syntax); var machine = new Optimize.Optimizer().Optimize(semantic); var node = new NscGenerator().Generate(machine); node.Accept(visitor); visitor.Result.Should().Be(expected); }
private void AssertGenerated(string transitionSyntax, string expected, EmptyVisitor visitor) { var header = "Initial: I FSM:f Actions:acts"; var syntax = new Parser(Tokenizer.Create()).Parse(header + transitionSyntax); var semantic = new Semantic.SemanticAnalyzer().Analize(syntax); var machine = new Optimize.Optimizer().Optimize(semantic); var node = new NscGenerator().Generate(machine); node.Accept(visitor); visitor.Result.Should().Be(expected); }
public string Generate(string input) { var syntax = new Parser(Tokenizer.Create()).Parse(input); var semantic = new Semantic.SemanticAnalyzer().Analize(syntax); var machine = new Optimize.Optimizer().Optimize(semantic); var node = new NscGenerator().Generate(machine); var visitor = new CsharpVisitor(); node.Accept(visitor); return(visitor.Result); }
private static void Compile(string inputFile, string outputFile) { var input = File.ReadAllText(inputFile); var syntax = new Parser(Tokenizer.Create()).Parse(input); var semantic = new SemanticAnalyzer().Analize(syntax); var machine = new Optimizer().Optimize(semantic); var node = new NscGenerator().Generate(machine); var visitor = new CsharpVisitor(); node.Accept(visitor); File.WriteAllText(outputFile, visitor.Result); }