Posted By:
Martin_Krueger
Posted On:
Sunday, August 5, 2007 03:25 PM
Hi, I have the following grammer: start: expr ; unary_expr : ('+'|'-')? expr; expr : (NUMBER) (OP expr)?; function: ID '(' param_list ')'; param_list: expr (',' expr)*; ID : ('a'..'z')+; NUMBER : ('0'..'9')+; OP : '+'|'-'|'*'|'/'; I expect that is could parse the expression "1+2", but it does not because of a NoViableAltException when parsing "+", but I don't know why? Greeting, Martin
More>>
Hi,
I have the following grammer:
start: expr ;
unary_expr
: ('+'|'-')? expr;
expr : (NUMBER) (OP expr)?;
function: ID '(' param_list ')';
param_list: expr (',' expr)*;
ID : ('a'..'z')+;
NUMBER : ('0'..'9')+;
OP : '+'|'-'|'*'|'/';
I expect that is could parse the expression "1+2", but it does not because of a NoViableAltException when parsing "+", but I don't know why?
Greeting,
Martin
<<Less