问题
I am currently creating a grammar using AnTLR4 targeting C# but I am facing a problem while developing a visitor. I can't find the class ParseTree referred in the book.
In the book we have:
LabeledExprLexer lexer = new LabeledExprLexer(input);
CommonTokenStream tokens = new CommonTokenStream(lexer);
LabeledExprParser parser = new LabeledExprParser(tokens);
ParseTree tree = parser.prog(); // parse
but I can't see the equivalent C# code.
Can you please help?
回答1:
Interfaces in C# have the prefix I
. The fully qualified name here is Antlr4.Runtime.Tree.IParseTree
.
来源:https://stackoverflow.com/questions/18219331/parsetree-in-antlr4-c-sharp