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

Jim Idle jimi at temporal-wave.com
Fri Oct 1 09:52:06 PDT 2010



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




More information about the antlr-interest mailing list