[antlr-interest] Context-Sensitive Follow Sets.. Bug?

Jim Idle jimi at temporal-wave.com
Fri Oct 1 12:12:40 PDT 2010


You need to post a complete grammar, not just a few fragments - sorry. I
also assume that you are using the latest version?

Jim

> -----Original Message-----
> From: Andrey Desyatov [mailto:andrey.desyatov at gmail.com]
> Sent: Friday, October 01, 2010 10:21 AM
> To: Jim Idle
> Cc: antlr-interest at antlr.org
> Subject: Re: [antlr-interest] Context-Sensitive Follow Sets.. Bug?
> 
> Thanks, Jim for fast reply.
> 
> I can't give you any info about the grammar from May thread.
> But in my grammar (the second link:
> http://www.antlr.org/pipermail/antlr-interest/2010-
> September/039764.html)
> I can see the same behavior (described at the link location).
> Definitions for Identifier, WS, Comments and so on are typical (according
to
> the book "The Definitive ANTLR Reference: Building domain-specific
> languages").
> Could you have a look on my grammar and the problem?
> 
> Kind regards,
> Andrey
> 
> 2010/10/1 Jim Idle <jimi at temporal-wave.com>:
> >
> >
> >> -----Original Message-----
> >> From: Andrey Desyatov [mailto:andrey.desyatov at gmail.com]
> >> Sent: Friday, October 01, 2010 9:28 AM
> >> To: Jim Idle
> >> Cc: antlr-interest at antlr.org
> >> Subject: Re: [antlr-interest] Context-Sensitive Follow Sets.. Bug?
> >>
> >> Sorry, Jim for the confusing question.
> >> I've tried to continue thread from May with subject
> >> "Context-Sensitive Follow Sets.. Bug?"
> >> (http://www.antlr.org/pipermail/antlr-interest/2010-May/038776.html),
> >> but without success (it was my second post to mailing list and I
> >> couldn't understand how to continue any thread).
> >
> > I had to remove the many stars from the grammar to see what it was:
> >
> > start: animal (AND acClass)? service EOF;
> >
> > animal: (DOG | CAT );
> >
> > service: (HARDWARE | SOFTWARE) ;
> >
> > AND: 'and';
> >
> > DOG: 'dog';
> >
> > CAT: 'cat';
> >
> > HARDWARE: 'hardware';
> >
> >
> > SOFTWARE: 'software';
> >
> > acClass
> > @init*
> > {
> >
> > System.out.println(computeContextSensitiveRuleFOLLOW().toString());
> > }
> > :
> > ;
> >
> > And the OP says:
> >
> >
> > Testing this grammar, with let's say input:
> > "*dog and software*",
> > the result in the console is:
> > "{4, 7, 8}" (which stands for tokens {THE, HARDWARE, SOFTWARE}),
> >
> > However, the grammar given does not have a token for THE, or a
> > specification for WS, or a grammar xzy;
> >
> > so the grammar is incomplete. I suspect that there is a problem with
> > the grammar and not the followsets. If someone can give a complete
> > example, then I can look at it
> >
> > Jim
> >
> >
> >
> >>
> >> Description of my problem I've given in another thread:
> >> http://www.antlr.org/pipermail/antlr-interest/2010-
> >> September/039764.html.
> >>
> >
> >
> >
> > List: http://www.antlr.org/mailman/listinfo/antlr-interest
> > Unsubscribe:
> > http://www.antlr.org/mailman/options/antlr-interest/your-email-address
> >



More information about the antlr-interest mailing list