我目前在ANTLR4中做识别器,我有一个错误:
The following sets of rules are mutually left-recursive [expr, index_expr, member_acc, expr1]
这是我的代码:
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: '==';
如何解决此错误?