Priority for nonterminal

Jul 11, 2014 at 7:25 PM
Edited Jul 11, 2014 at 7:36 PM
I have this rules:
boolNot.Rule = ToTerm("!") + expr | ToTerm("!") + "(" + expr + ")";
expr.Rule = directAccess | call | identifier | boolNot | booleanExpression;
booleanExpression.Rule = expr + "&&" + expr | expr + "||" + expr | expr;
Sometimes, input looks like this:
!isDefined(test) && test
In this case this line parsed like boolNot node which contains 2 nodes: "!" and booleanExpression, but this line should be parsed like booleanExpression which contains boolNot node and etc. So if parser guess that expr contains booleanExpression or boolNot, he should prefer booleanExpression. Is this possible?
Coordinator
Jul 11, 2014 at 7:55 PM
as far as i can understand, the issue is operator precedence - you should register ! operator and give it higher precedence than &&