I have a very simple grammar here:
grammar mygrammar;
prog : E 'arrow' ('and' E PATTERN) ;
PATTERN : ( BPATTERN | ('and' PATTERN)+ | ('or' PATTERN)+ ) ;
BPATTERN : ( L | P ('and' E PATTERN) ) ;
L : ( E | 'not' E | U | 'not' U ) ;
P : 'p' ;
U : 'u' ;
E : 'e' ;
WS : [ \t\r\n]+ -> skip ;
All the input strings I parse, the error is always the same:
line 1:0 mismatched input 'e' expecting 'e'
If I change the 'e' token with 'x', I got the same but with 'x' inside, so the problem seems to be related to the non-terminal E. Does anyone know where is the error?