I am trying to describle simple grammar with AND
and OR
, but fail with the following error
The following sets of rules are mutually left-recursive
The grammar is following:
expr:
NAME |
and |
or;
and:
expr AND expr;
or:
expr OR expr;
NAME : 'A' .. 'B' + ;
OR: 'OR' | '|';
AND: 'AND' | '&';
Simultaneously, the following grammar
expr:
NAME |
expr AND expr |
expr OR expr;
NAME : 'A' .. 'B' + ;
OR: 'OR' | '|';
AND: 'AND' | '&';
does compile.
Why?