Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get IParseTree in ANTLR4?

I am currently using ANTLR4 in C# but I am facing a problem, I don't know how to get the the object/class IParseTree.

I find in C# the fully qualified name here is Antlr4.Runtime.Tree.IParseTree but how to get the object?

AntlrInputStream inputStream = new AntlrInputStream(sSpinTexte);
SpinParserLexer SpinLexer = new SpinParserLexer(inputStream);
CommonTokenStream commonTokenStream = new CommonTokenStream(SpinLexer);
SpinParserParser SpinParser = new SpinParserParser(commonTokenStream);
IParseTree tree = ?????

Can you please help?

like image 223
LeMoussel Avatar asked Nov 02 '22 09:11

LeMoussel


1 Answers

Thanks to the comment of Cv4, this is the code I used:

IParseTree tree = SpinParser.expr();
like image 159
LeMoussel Avatar answered Nov 15 '22 03:11

LeMoussel