I have the rule:
expression
: //...
| expression (relative_operator expression)+
| //...
;
Ideally, when I put in 1=1=1
, it will produce the expression(1, =, 1, =, 1)
tree. However, in reality it produces expression(1, =, expression(1, =, 1))
. This is because it prefers to parse recursively rather than in a line. Is it possible to explicitly tell a rule that it either can't recurse on itself, or it should prefer to obey the +
/*
before trying to recurse on itself?