[antlr-interest] best method of outputting multiple templatesfrom AST?

Terence Parr parrt at cs.usfca.edu
Tue Oct 17 10:18:40 PDT 2006


On Oct 16, 2006, at 11:27 PM, Hill, Robert wrote:

> Thanks Ter!
> 	I'd ended up settling on that because after another hour of
> reflecting about neater ways came to the conclusion that it was the  
> only
> choice, and it doesn't actually make much sense to try to return  
> chunks
> of code/templates from rules when they're not going to be in the order
> the token came in. You hit the nail on the head - "decoupling the  
> output
> from the order of tree traversal",

Yep, I consider that a *fundamental* idea for translation (even Andy  
would agree as he doesn't traverse the trees at all).

> pretty much what I ended up with :) I
> thought I may have been missing something, or some syntax (other than
> returns [String Template blah]) on the rules to allow this. I was
> thinking , just how much of the stuff I've done that isn't on the wiki
> anywhere....

Then you should be putting it up there! ;)

> can I pre-order your book? LOL!

Not yet...perhaps Jan/Feb for a beta book.

> And I've lost count of the number of times I've typed in
> myArraylist.size	instead of .size() <sigh> I miss those c#
> properties! :(
>
> Ok :) sweet, im back in business!
>
> Ta very much!

:)

Ter


More information about the antlr-interest mailing list