[antlr-interest] unexpected NoViableAltException

Terence Parr parrt at cs.usfca.edu
Sun Nov 19 11:22:26 PST 2006


Hi :)

ml and with can be followed by EOF, but expr cannot.  'mit' follows  
exp.  NoViableAltException because in rule exp, ANTLR cannot imagine  
how EOF can be matched.

Ter

On Nov 19, 2006, at 11:07 AM, Dieter Frej wrote:

> Hi everybody,
>
> I need your help because I am totally puzzled about my very easy  
> grammar.
> The grammar contains three parser rules
>
> ml
> 	:	exp 'mit' with
> 	;
> 	
> exp
> 	:	(IDENT '=' SEMI)*
> 	;
>
> with
> 	:	(IDENT '='  SEMI)*
> 	;
>
> I used the interpreter of antlrworks for the
> - rule 'with' and the input 'bla=;' (without ')
> -> everything works fine
>
> - rule 'exp' and the (same) input 'bla=;'
> -> I get a NoViableAltException
>
> - rule 'exp' and the input 'bla =; mit blubb=;'
> -> works fine
>
> - rule 'ml' and the input 'bla =; mit blubb=;'
> -> works fine (as expected)
>
> I have not idea what the problem is. I know that the order of rules
> appearing in the grammar has effect, so I changed it, but still the
> same... :-(
>
> Thanks in advance,
>
> - Didi
> -- 
> Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen!
> Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer
> <noviablealtexception.g>



More information about the antlr-interest mailing list