[antlr-interest] Re: Translators Should Use Tree Grammars

John D. Mitchell johnm-antlr at non.net
Sun Nov 21 22:35:52 PST 2004


>>>>> "atripp54321" == atripp54321  <atripp at comcast.net> writes:
[...]

>> I'll counter by saying we shouldn't be printing back this way. ;)
>> Templates are the name of the game for generating output :) If the
>> output is very similar to the input, a better way is to just do my
>> tricks: either TokenStreamRewriteEngine or track token order in the tree
>> so you can dump automatically :)

> Yea, I suppose a treewalker is fine when the output is so very close to
> just a printing of the inorder traversal of the AST.  But I'm still not
> convinced that a treewalker is the best for very complex AST-to-AST
> transformations.

I'm confused.  Are you talking about source output or tree manipulations
(or both)?

For emitting source, a tree walker which builds up attributes on the way
down and emits (using e.g., StringTemplates) when coming back up is pretty
slick.

For generating new trees, you might want to check out the recent thread
where Loring and I talked about tree creation instruction streams.

Take care,
	John


 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/antlr-interest/

<*> To unsubscribe from this group, send an email to:
    antlr-interest-unsubscribe at yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 





More information about the antlr-interest mailing list