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

micheal_jor open.zone at virgin.net
Sat Nov 20 19:21:52 PST 2004



--- In antlr-interest at yahoogroups.com, Terence Parr <parrt at c...> wrote:

> Hi Andy,
> 
> I'm on a coding frenzy on 3.0 so I'll have to comment in detail later, 
> but I built an emitter for my CS652 students doing the "Java + C++ 
> style comments" project.  Trivial but a hassle.  Took me a few hours 
> rather than a day or two.  Want it?  559 lines and handles precedence 
> properly so that extra parentheses are not generated spuriously (well, 
> that was my intent) ;)

I'd like to take a gander ;-)

Add to file sharing maybe?

> As you point out further in your response to Loring, the tree grammar 
> one is sometimes less obvious to the newbie for sure!
> 
> 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 :)

Do you have articles/samples demonstrating the use of string templates
for output (including pretty-printing) too? ;-)

Micheal
ANTLR/C#






 
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