public static TortoiseProgram Compile(string source) { AntlrInputStream antlerStream = new AntlrInputStream(source); TortoiseLexer lexer = new TortoiseLexer(antlerStream); CommonTokenStream tokenStream = new CommonTokenStream(lexer); TortoiseParser parser = new TortoiseParser(tokenStream); parser.prog(); // <-- compile actually happens here (see Assets/Grammars/Tortoise/Tortoise.g4 TortoiseCompiler compiler = parser.Compiler; TortoiseProgram program = new TortoiseProgram(compiler.Commands); return(program); }
public static TortoiseProgram Compile(string source) { AntlrInputStream antlerStream = new AntlrInputStream(source); TortoiseLexer lexer = new TortoiseLexer(antlerStream); CommonTokenStream tokenStream = new CommonTokenStream(lexer); TortoiseParser parser = new TortoiseParser(tokenStream); parser.prog(); // <-- compile actually happens here (see Assets/Grammars/Tortoise/Tortoise.g4 TortoiseCompiler compiler = parser.Compiler; TortoiseProgram program = new TortoiseProgram(compiler.Commands); return program; }