Below is the message John B. Brodie sent to me :

(again tried to send a copy of this to the list, but failed)

On Mon, 2010-01-11 at 16:46 +0100, Aurélien LARIVE wrote:
> Hi,
> 
> I successfully buit an AST using the operators notation (^) but I need 
> to customize a bit my AST construction. Could someone tell me what's the 
> rewrite rules version of the following rule ?
> 
> andexpression
>     : notexpression ( AND^ notexpression )*
>     ;
> 
> I found a similar example at 
> http://www.antlr.org/wiki/display/ANTLR3/Tree+construction but I failed 
> to apply this to my problem.
> 

off the top of my head:

andexpression
     : l=notexpression ( AND r=andexpression -> ^(AND $l $r) )?
     ;

but i have a vague memory that the associativity of these two are
different.  would need to look into that if associativity matters in
your application.



List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address
-- 
You received this message because you are subscribed to the Google Groups 
"il-antlr-interest" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en.


Reply via email to