Safiye Celik wrote: > Hi, > I am writing an ANTLR code in Java. I am using ANTLR version 3. I > created my tree, but how can I show the tree on the screen. On the > internet, there are lots of info about doing that job in ANTLR v2. > They create an ASTFrame object from created CommonAST tree and use > ASTFrame's setVisible() function to show it. But CommonTree is used in > v3 instead of AST, so I cannot write it in that way. So, what is the > v3 correspondence of the ASTFrame usage?? > > Below is my CommonTree creation code. > > String s = //assigned to an expression valid in my grammar; > MyLexer lexer = new MyLexer( new ANTLRStringStream(s) ); > CommonTokenStream tokens = new CommonTokenStream(lexer); > MyParser.expression_return ret = parser.expression(); > CommonTree exptree = ( CommonTree ) ret.tree; > > What I need it how to show that "exptree" on the screen?? > > Thanks in advance. Search the list (see link to markmail in the support section of antlr.org) for my instructions on creating a .dot representiation of the AST then using the dot command to create a .png/.gif/.whatever. It is a few lines of code, reproduced in the email.
Jim 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 -~----------~----~----~----~------~----~------~--~---
