[antlr-interest] Is it because of buggy antlr?

rmsanjivp <rmsanjivp at yahoo.com> rmsanjivp at yahoo.com
Mon Jan 20 18:24:52 PST 2003


Consider the following rules:

expr
 : e1 (PLUS | MINUS e1)*
 ;

e1
 : e0 ( POWER e1)? // to make POWER tree as right associative
 ;

e0: ID;


For the following parser the generated code in C++ when compiled and 
run gives unexpected token for input "P1 + p2"

If the right associative part is changed to

e1
 : e0 ( POWER e0)*
 ;

then all works fine except that the operator POWER is treated as 
right associative.

Any idea how to make an operator left associative?

Thanks,
Sanjiv


 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 



More information about the antlr-interest mailing list