Hello,
My name is Ram and I use grammatica SW as a part of my acadmic project in the university.
I use grammatica to help me develop c parser (an important part of my project).
I get an inherent ambiguity error which I cannot solve,
The code is:
/* _expression_ */
_expression_ = Term [ExpressionRest] ;
ExpressionRest = "+" _expression_
| "-" _expression_ ;
Term = Factor [TermRest] ;
TermRest = "*" Term
| "/" Term
| "%" Term ;
Factor = Atom
| "(" _expression_ ")" ;
Atom = Number
| STRING_DATA
| VARIABLE_NAME
| FunctionCall
| Casting;
Number = INT_NUMBER | FLOAT_NUMBER;
/* Condition Statement */
Condition = ConditionTerm [ConditionRest] ;
ConditionRest = AND Condition
| OR Condition ;
ConditionTerm = ConditionAtom
| "(" Condition ")" ;
ConditionAtom = Value ConditionOperator Value ;
ConditionOperator = "==" | "!=" | ">" | "<" | "<=" | ">=";
Value = _expression_;
The error is:
Error: in pt.grammar: lines 163-164:
inherent ambiguity in production 'ConditionTerm' starting with
token "("
ConditionTerm = ConditionAtom
| "(" Condition ")" ;
I understand why it happens, there is unlimit look ahead option but how can I solve it ?
Thanks,
Ram.