[antlr-interest] [newbie] nondeterminism upon error

Chris Eidhof chris at eidhof.nl
Sat Nov 25 02:43:31 PST 2006


Hi all,

I'm getting this nondeterminism upon error:

> hasdat.g:67: warning:nondeterminism upon
> hasdat.g:67:     k==1:SMALL
> hasdat.g:67:     between alt 1 and exit branch of block

at line 67 is the following code:
> idrest: (SMALL | LARGE | DIGIT | APOS)*;

And the following terminals are defined (among others):
> APOS        : "'" ;
> SMALL       : 'a'..'z' ;
> LARGE       : 'A'..'Z' ;
> DIGIT       : '0'..'9' ;

So, there's nondeterminism upon the first alternative and the idrest  
that matches nothing?

The idrest is used in the following lines:
> conid: LARGE idrest;
> varid: SMALL idrest;

What I also tried was removing the star operator from idrest, and  
change the two lines too:
> conid: LARGE (idrest)*;
> varid: SMALL (idrest)*;

Can anyone give me some hints? I don't get why that rule is  
nondeterministic... If anyone wants to see the whole file I can put  
it online somewhere.

Thanks a lot,
-chris


More information about the antlr-interest mailing list