Reputation: 737
This is part of the grammar of the NuSMV language:
BasicExpression:
Constant | '(' BasicExpression ')' | '!' BasicExpression | BasicExpression '&' BasicExpression;
Constant:
BooleanConstant
BooleanConstant:
'TRUE' | 'FALSE';
Unfortunately XText is throwing an exception that states there is left recursion in this grammar. How can I fix it?
Thanks.
Upvotes: 1
Views: 275
Reputation: 3526
You could simply introduce a new rule (a new tier) like that:
BasicExpression:
firstContent=ExpressionContent ("&" secondContent=ExpressionContent)?
;
ExpressionContent:
Constant
| '(' BasicExpression ')'
| '!' BasicExpression
;
That way the rule is not left recursive anymore.
Greeting Krzmbrzl
Upvotes: 1
Reputation: 4058
Have a look at this article or the official documentation, it will explain in detail how to handle recursion in language, and taking into account operator precedence.
Upvotes: 0