Search code examples
interpreterantlr4antlrworksparse-tree

How to get parse tree in ANTLRWorks 2?


I am currently using ANTLRWorks 2. I don't know how to interpret example in it. In ANTLRWorks-1.5.2 there is an interpreter tab that you can paste your example. Is there something like that in ANTLRWorks 2? How you can get parse tree for input? Does input have to be in a specific file? BTW, I couldn't get any result by using Run->Run in TestRig and uploading any input file.


Solution

  • How you can get parse tree for input?

    The way you already tried: RunRun in TestRig

    Does input have to be in a specific file?

    Yes.

    BTW, I couldn't get any result by using Run->Run in TestRig and uploading any input file.

    Then you probably did something wrong. Incorrect input file? Incorrect start rule? Pretty hard to say, really.

    There's also the ANTLR4 plugin for IntelliJ which does interpreting on the fly and produces the parse tree. Also a very nice tool!