Hi
This is something stupid, I guess. I have a grammar like this below
and I would like to know why
"1+1-1" works
and
"1-1+1" does not work (NoViableAltException)
Thanks
Leo K.
>>>>>>>>>>>>>>>>>
grammar Expr;
@header {
}
@members {
}
prog: stat+ ;
stat: comp NEWLINE
| NEWLINE
;
comp
: e=expr
( '>' expr
| '<' expr
| '=' expr
)*
;
expr
: e=multExpr
( '+' multExpr
| '-' multExpr
| '*' multExpr
| '/' multExpr
)*
;
multExpr
: atom
( atom
)*
;
atom
: INT
| ID
| '(' comp ')'
;
ID : ('a'..'z'|'_')+ ;
INT : '0'..'9'+ ;
NEWLINE:'\r'? '\n' ;
WS : (' '|'\t')+ ;
[]
Leonardo K. Shikida
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.