0

I currently do a recognizer in ANTLR4 and I have an error:

The following sets of rules are mutually left-recursive [expr, index_expr, member_acc, expr1]

This is my code:

num_opds: INTLIT|FLOATLIT;
bool_opds: TRUE|FALSE;
str_opds: STRINGLIT;
operators: ADD|SUB|MUL|DIV|MOD|EQUAL;
expr: <assoc=left> (<assoc=right> (ADD|SUB|NOT)? expr1) (operators (<assoc=right> (ADD|SUB|NOT)? expr1))*;
expr1: (LB expr RB)|ID|num_opds|bool_opds|str_opds|index_expr|member_acc;
index_expr: expr LSB expr RSB;
member_acc: expr DOT ID (LB expr RB)?;

Lexer Token:

LB: '(';
RB: ')';
LSB: '[';
RSB: ']';
DOT: '.';
NOT: '!';
EQUAL: '==';

How can I fix this error ?

Alex
  • 25
  • 6

0 Answers0