Safiye Celik wrote:
Hi,Take a step back here - you probably don't need to do this. The point of an AST isn't to make it readable to you per se (though it helps ;-), but to make sure it is unambiguous to the tree parser. If this is your exact grammar then the tree rule is just: a: b A; b : ^(C B); And if you need to process A in some actions in rule b, then just pass it to rule B (but you might be better initiating the action in rule a and having the b tree available. If you cannot change the rules then there isn't much you can do ;-) However perhaps you could inherit the originating grammar in an import within a new grammar, then just override rule a: import existing.g a : C^ B A ; You could also use actions to build the AST yourself, but then that is a modification to the rules of course. You could also add action code in the tree parser to traverse the tree of b. Finally you could have an interim tree grammar that rewrites the tree to your purposes. Jim --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "il-antlr-interest" group. To post to this group, send email to il-antlr-interest@googlegroups.com To unsubscribe from this group, send email to il-antlr-interest+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/il-antlr-interest?hl=en -~----------~----~----~----~------~----~------~--~--- |
List: http://www.antlr.org/mailman/listinfo/antlr-interest Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address