[antlr-interest] unexpected NoViableAltException

Dieter Frej dieter_frej at gmx.net
Sun Nov 19 11:33:42 PST 2006


thanks Ter.

Using v3 I thought I do not have to put EOF in the grammar anymore. So,
when I choose a rule there is no EOF automatically at the end of that
rule?

- Didi



-------- Original-Nachricht --------
Datum: Sun, 19 Nov 2006 11:22:26 -0800
Von: Terence Parr <parrt at cs.usfca.edu>
An: ANTLR Interest <antlr-interest at antlr.org>
Betreff: Re: [antlr-interest] unexpected NoViableAltException

> 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>

-- 
Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! 
Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer


More information about the antlr-interest mailing list