[antlr-interest] simple novice grammar question

Monty Zukowski monty at codetransform.com
Wed May 26 08:12:37 PDT 2004


On May 25, 2004, at 12:45 PM, Greg Gimler wrote:

> I guess you can't have tree suffixes on rules, only tokens?

That is correct.  You can get by with manual tree building in that case 
but it's quite a bit uglier.  We plan to handle this properly with 
ANTLR 3 (a far ways off)

You would think this would do it:

bool_comp : factor    (b:bool_op! f:factor! {##=#(#b, ##, #f);})? ;

But I believe it would treat ## as a node not a tree, so if factor 
called filter it would get truncated.  So you have to mess with 
ASTFactory stuff.  In fact I posted about this last month, but it's not 
worth the trouble for your little grammar.

Monty Zukowski

ANTLR & Java Consultant -- http://www.codetransform.com
ANSI C/GCC transformation toolkit -- 
http://www.codetransform.com/gcc.html
Embrace the Decay -- http://www.codetransform.com/EmbraceDecay.html



 
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