Le 13 avril 2010 21:24, Gerald Rosenberg <[email protected]> a écrit :
> ------ Original Message (Tuesday, April 13, 2010 11:12:53 > AM) From: Sébastien Kirche ------ > Subject: Re: [antlr-interest] CommonTree -> AST conversion ? > > Do you mean to generate the tree walker by writing a tree grammar on top of > my parser grammar, or am I missing an antlr feature ? > > Yes, just write a simple tree pattern matcher and have Antlr generate the > tree walker code. Lots of examples and more explanation in Language > Implementation > Patterns<http://pragprog.com/titles/tpdsl/language-design-patterns>. > http://www.antlr.org/wiki/display/ANTLR3/Tree+pattern+matching > > [...] > And I also find quite ugly the mix of grammar code with java code : I > fear that when my grammar will grow the maintenance of the resulting code > will become hard. > > Yes, best to minimize the mix. You can either use the superclass option ( > http://www.antlr.org/wiki/display/ANTLR3/Grammar+options) or, better, set > a helper class on the parser that can then be called from the actions. > > Yes, decoupling the application-specific code from the parser code with a helper class sound a reasonable solution. I will try that. And thanks for your documentation pointers. -- Sébastien Kirche 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.
