I use ANTLR to create a grammar, but I get this error
error(211): [fatal] rule conditions has non-LL(*) decision due to recursive rule invocations reachable from alts 1,2. Resolve by left-factoring or using syntactic predicates or using backtrack=true option.
my grammar rules:
conditions
: '(' conditions ')'
| condition (C_BINARY_OPERATOR conditions)?
;
condition
: expression C_CONDITIONAL_OPERATOR expression
;
expression
: (term) (('+'|'-') term)*
;
term
: (factor) (('*' | '/') factor)*
;
factor
: C_ID
| C_NUMBERS
| '(' expression ')'
;
// Binary Operators for Logical Calculation
C_BINARY_OPERATOR
: '&&'
| '||'
;
// Conditonal Operators
C_CONDITIONAL_OPERATOR
: '>'
| '<'
| '=='
| '!='
| '=<'
| '=>'
;
How can I fix this error?
Well, the error does say "Resolve by left-factoring or using syntactic predicates or using backtrack=true option". Is that confusing?