Le 12 avril 2010 21:40, Gerald Rosenberg <[email protected]> a écrit :
> ------ Original Message (Monday, April 12, 2010 8:16:53 > PM) From: Sébastien Kirche ------ > Subject: [antlr-interest] CommonTree -> AST conversion ? > > Could someone correct my code or point me an example more complete that the > code snippet that is mentioned in the wiki ? And could you point me some > code for a custom tree walker? > > Just use Antlr to generate a sample tree walker. The generated code is > quite readable and will be an example specific to your AST. > > I have read some mentions about implementing a visitor pattern, it that the > regular way ? > > > The regular way is to just use a generated tree walker. > Thanks for your feedback, but I am not sure to understand clearly :) 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 ? When I was talking about implementing a visitor, it was related to the article « Manual Tree Walking Is Better Than Tree Grammars »[1] and have also seen a mention of it by Terence Parr in the mailing list archives. And it was also to see what is under the hood of the tree grammars, like learning some assembly helps to understand the work of a C compiler. 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. Thanks for your support. [1] http://antlr.org/article/1170602723163/treewalkers.html -- 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.
