The stm
and stmList
gives me this error, it seems that ANTLR see it like a possible infinite recursion loop. How can I avoid it? The following sets of rules are mutually left-recursive [stmList]
stmList: stm stmList | ;
stm: ifStm | whStm;
ifStm: ifPart elifPart* elsePart?;
ifPart: IF LB exp RB CLB stmList CRB;
elifPart: ELIF LB exp RB CLB stmList CRB;
elsePart: ELSE CLB stmList CRB;
whStm: WHILE LB exp RB CLB stmList CRB;
LB: '(';
RB: ')';
CLB: '{';
CRB: '}';
WHILE: 'While';
IF: 'If';
ELIF: 'Elif';
ELSE: 'Else';
stmList
rule is right-recursive. There's no left recursion here. – Chris Dodd