ParseTree in AnTLR4 C#

2019-07-21 02:44发布

问题:

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.