FW: [antlr-interest] Serious Bug when using BitSetgeneration-Forgot

Geir Ove Skjaervik geiroves at online.no
Tue Oct 11 02:45:32 PDT 2005


Hello,

Thanks a lot for taking the time to look at my problem !

The reason why there's empty productions is that I have a common parser
structure that matches several similar looking files. There is most
certainly other ways to do that, one of them is to write out the grammar
for each version completely, but more clever solutions probably exists.
I used the common structure to try to reduce the size of my grammar file
that has already reached 2200 lines.

I am also under considerable time pressure with a delivery coming up in
1 month, and weekly milestones putting pressure on me. So unfortunately
I do not see that I have the time to produce the mini grammar that
reveals the error like you ask for.

Hopefully we can find a solution to this "Empty Pruction & BitSet wrong
code generation". 

It has kept my puzzling about errors in my grammar for a long long time,
but I have put off investigating it because there had been other more
important things to look at. However, I know had to solve it, and it
turned out to be a Bug ! 

Most certainly this problem may have kept other Grammar Writers busy
looking for problems in their grammar, when it actually is ANTLR that
plays a trick on them.  Thus, finding and Solving or Documenting this
Bug seems rather important to me for the ANTLE community. 

Geir Ove

-----Original Message-----
From: antlr-interest-bounces at antlr.org
[mailto:antlr-interest-bounces at antlr.org] On Behalf Of Ric Klaren
Sent: 11. oktober 2005 00:08
To: antlr-interest at antlr.org
Subject: Re: FW: [antlr-interest] Serious Bug when using
BitSetgeneration-Forgot


Hi,

Geir Ove Skjaervik wrote:
> When you have the time, can you please consider this problem ? It 
> looks like a bug to me as my code work when I do NOT use 
> Bitsets.However, I guess the if() code is more time consuming. I also 
> think it is important for everyone to know about this scenario, and 
> how to avoid it if possible.

To avoid it my guess would be: don't make rules that match nothing.
Another work around is to change the bitset option for the rule (not
100% sure if that is supported) Empty rules are generally a good source
for unintuitive (and now also) bad behaviour with antlr.

I myself will probably not have much time to look at it this week
(workshop/trip preparations). Could you make a small example grammar of
this (it's enough if it produces code) makes bughunting faster. I will
probably have some time to look at it before/during the workshop next
week.

Cheers,

Ric





More information about the antlr-interest mailing list