[antlr-interest] Re: Building trees with the correct associativity

Monty Zukowski monty at codetransform.com
Thu Dec 2 00:43:19 PST 2004


On Dec 1, 2004, at 7:00 PM, Paul J. Lucas wrote:

>> Out of curiosity, why are you avoiding the more compact
>>
>> addExpr
>>     :
>>     mulExpr (addOp^ mulExpr)*
>>     ;
>>
>> The binary trees avoid inserting the extra node.
>
> 	Because that's illegal syntax in ANTLR 2.7.x.  addOp is not a
> 	token.  But this is orthoganal to the problem at hand.
>

Well, at least that one is easy:

addExpr
	:
	mulExpr ( (PLUS^ | MINUS^) mulExpr)*
	;

Monty



 
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