[antlr-interest] HELP!!!: with left recursion
aaanwar
aaanwar at yahoo.com
Sun Nov 2 22:35:33 PST 2003
Greetings,
Any advise on this:
exp --> let decs in exp end
| if exp then exp end
| if exp then exp else exp end
| for ID := exp to exp do exp end
| while exp do exp end
| lvalue
| lvalue :=exp
| builtin
| ID ( arg_seq )
| ID ( )
| exp & exp
| exp | exp
| exp * exp
| exp / exp
| exp + exp
| exp - exp
| exp = exp
| exp > exp
| exp >= exp
| exp < exp
| exp <= exp
| exp <> exp
| INTEGER_LITERAL
| STRING_LIT
| ( exp_seq )
| ( )
I tried this but no luck:
exp : expr (binaryOp expr)*;
expr : LET decs "in" exp END
| IF exp THEN exp (ELSE exp)?
END
| FOR ID ASSIGN exp TO exp DO
exp END
| WHILE exp DO exp END
| lvalue (ASSIGN exp)?
| builtin
| ID LBRACKET (arg_seq )?
RBRACKET
| INTEGER_LITERAL
| STRING_LIT
| LBRACKET exp_seq RBRACKET
| LBRACKET RBRACKET ;
binaryOp : AMPERSAND
| OR
| STAR
| DIV
| PLUS
| MINUS
| EQUAL
| GT
| GTEQ
| LT
| LTEQ
| NOTEQ;
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list