I'm new using Antlr4 but I know that exist a plugin for Eclipse. I have a simple question...After I created the g4 file how can I visualize the live parse tree in order to see the tree of an input expression? Thanks
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
Currently there is no provision for viewing live parse tree in ANTLR 4 IDE for Eclipse.
Meanwhile, you can see the parse tree using -gui switch in the command line. It also provides a feature of saving the parse tree as PNG.
回答2:
After installing Antlr4Ide plugin in Eclipse:
- Window>Show View>Other, Antlr4>Parse tree
- Activate g4 file
- Click parsing rule in g4 file, Parse tree now shows active rule above source editor box
In the parse tree view you see a live source editor on the left, with syntax highlighting for your language. When you enter code in your language there, the tree will update on the right. The antlr console shows parsing errors at the same time.