How is operator precedence implemented in ANTLR?
I'm using the XText/Antlr package at the moment.
Edit:
I did what sepp2k suggested, and operator precedence works now, but stuff like 3 +* also work now. The operators are basically "falling through" the tree.
Also, I tried the C grammar on ANTLR's website and the same thing happened in ANTLRworks.
Anyone know what the issue is?
BinaryExpression:
'or'? AndOp; //or op
AndOp:
'and'? ComparisonOp;
ComparisonOp:
('>'|'<'|'>='|'<='|'=='|'~=')? ConcatOp;
ConcatOp:
'..'? AddSubOp;
AddSubOp:
('+' | '-')? MultDivOp;
MultDivOp:
('*' | '/')? ExpOp;
ExpOp:
'^'? expr=Expression;