How to generate python tree using command line?

Viewed 49

I already know how to generate java tree using command line

java -cp ".;D:\lib\antlr\antlr-4.9.2-complete.jar" org.antlr.v4.gui.TestRig Java8 compilationUnit Test2.java -tree

Thank you friend for your help but... How to generate python tree using command line? I imitated the above statement but couldn't succeed

I am using Python3Lexer.g4 and Python3Parser.g4 in g4

enter image description here

1 Answers

The TestRig expects the name of the grammar (in this case Python3) and the name of your start rule. Good candidates are generally those rules that end in EOF since they are intended to parse all of you input. The Python grammar has file_input and eval_input. So I would expect file_input to be your answer.

try:

java -cp ".;D:\lib\antlr\antlr-4.9.2-complete.jar" org.antlr.v4.gui.TestRig Python3 file_input pythonPgm.py -tree
Related