the "expr" rule in the ANTLR grammar below is obviously mutually left recursive. As a beginner, ANTLR is hard to solve my problem. I read "Conflict Resolution Without LL (*)" in the ANTLR directory, but I still don't see a solution. Any pointers?
LPAREN: ('(');
RPAREN: (')');
AND: ('AND' | '&' | 'EN');
OR: ('OR' | '|' | 'OF');
NOT: ('-' | 'NOT' | 'NIET');
WS: ('' | '\ t' | '\ r' | '\ n') {$ channel = HIDDEN;};
WORD: (~ ('' | '\ t' | '\ r' | '\ n' | '(' | ')' | '"')) *;
input: expr EOF;
expr: (andexpr | orexpr | notexpr | atom);
andexpr: expr AND expr;
orexpr: expr OR expr;
notexpr: NOT expr;
phrase: '"' WORD * '"';
atom: (phrase | WORD);
source
share