[antlr-interest] Can someone please explain

Balvinder Singh bals1978 at hotmail.com
Fri Jun 21 06:52:09 PDT 2002


The definition you have produced is for Follow set.

First(B) ( assuming B is Nonterminal)  is the first tokn of all the string
which can be derived from B.


balvinder



----- Original Message -----
From: "Silvain Piree" <s.piree at enneya.com>
To: <antlr-interest at yahoogroups.com>
Sent: Friday, June 21, 2002 7:13 PM
Subject: Re: [antlr-interest] Can someone please explain


> Bals,
>
> do I understand correctly that First(B) means the tokens
> that can follow B?
>
> The grammar rule I mentioned is the full grammar!
>
>     rule:    A (B)? C D E       |     A (B)? C D F   ;
>     First(B) = 'C'
>     First(C) = 'D'
>     Intersection = null
>
> Silvain
>
> >  It might be the case in ur grammar that intersection of
> > First(B) and First(C) is not null.
> >
> > > 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/
> > >
> > >
> > >
> >
> >
> >
> > Your use of Yahoo! Groups is subject to
http://docs.yahoo.com/info/terms/
> >
> >
>
>
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>

 

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



More information about the antlr-interest mailing list