Look at the code for DOTTreeGenerator.java or use toStringTree() if that gives you a good enough representation.
Jim > -----Original Message----- > From: [email protected] [mailto:antlr-interest- > [email protected]] On Behalf Of Ketan Maheshwari > Sent: Monday, March 29, 2010 7:36 AM > To: [email protected] > Subject: [antlr-interest] How to get GUI like tree structure > > Hello Friends > > I am trying to use the CommonTree generated by the parser of my grammar > against a test code. > > Using the getChild(index).toString method, I get the tokens well. > > However, I do not know how can I also get a hierarchy of the rule to > which > they belong to. Similar to what we get in the ANTLRworks GUI. > > Any clue how can I get a tree such that it shows complete hierarchy of > the > grammar and the tokens as leaf nodes only. > > Am I using the correct Data Structure (CommonTree) ? > > Thanks for any clues. > > Regards > Ketan > > List: http://www.antlr.org/mailman/listinfo/antlr-interest > Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your- > email-address List: http://www.antlr.org/mailman/listinfo/antlr-interest Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address -- You received this message because you are subscribed to the Google Groups "il-antlr-interest" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/il-antlr-interest?hl=en.
