[antlr-interest] Can someone please explain

Silvain Piree s.piree at enneya.com
Fri Jun 21 06:09:20 PDT 2002


I understand the solution, but I don't understand the problem!

Why is making a token optional in both subrules producing
a conflict that can not be resolved with regular lookahead?

Silvain

>  Use syntactic predicate like this
> 
>  (A(B)?)=>A(B)?
> 
> It will remove the warnings but I'm not sure about run time 
> behaviour... and not sure if you add some new production, 
> whether i will work or not.
>
> > I'm getting nondeterminism warnings on my grammar but
> > I don't understand why.
> >
> > Following rule does not cause a problem when using k=5:
> >
> > rule:    A B C D E       |     A B C D F   ;
> >
> > But, when I make the B optional then I get a nondeterminism
> > warning regardless of lookahead 'k':
> >
> > rule:    A (B)? C D E       |     A (B)? C D F   ;
> >
> > Any suggestions would be much appreciated,
> >
> > Silvain




 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 



More information about the antlr-interest mailing list