[antlr-interest] Serious Bug when using BitSetgeneration

Terence Parr parrt at cs.usfca.edu
Tue Nov 8 09:58:06 PST 2005


On Nov 8, 2005, at 8:18 AM, Geir Ove Skjaervik wrote:

> Hello,
>
> Just one more comment on this Bug. It is ** clearly ** a bug, since
> ANTLR does work correctly when BitSets are NOT used. I find it strange

Hi.  Yes, that does seem to say there is a bug.  Note that I cannot  
reproduce this bug.  I added an empty alt and I still get correct code.

class T extends Parser;

x : A|C|D|E|F|G|H;

s : a b ;

// here is the rule of interest
a : B
    | {p1}? ( )
    | {p2}? ( )
    |
    ;

b : A|D|F|G|H;

For rule a() I generate the decision:

             if ((LA(1)==B)) {
                 match(B);
             }
             else if (((_tokenSet_1.member(LA(1))))&&(p1)) {
                 {
                 }
             }
             else if (((_tokenSet_1.member(LA(1))))&&(p2)) {
                 {
                 }
             }
             else if ((_tokenSet_1.member(LA(1)))) {
             }

Unless you can send me a small piece of code that breaks, I may not  
be able to track it down in a reasonable amount of time, which means  
it won't get solved.

> that this Bug  seems to be passed in almost silence: I would think  
> it to

I'm hoping that is because it's not bitten that many people.

> be rather serious to have a "sleeping" bug that may come and bite you
> any time you encounter the right conditions.
>
> Terrence asked me to try to produce a small grammar example to try to
> reproduce the problem. I will as soon as time on my project permits  
> it.
>
> BUT I would think it is equally IMPORTANT for the ANTLR team to try to
> hunt down this ** serious ** bug. It is nice that ANTLR 3.0 is under
> development, but we sure need a strong ** core ** technology that  
> won't
> fail.

Wow.  You're pretty demanding for somebody using my free software.   
once you give me a small test that breaks, quoting you, "I will [work  
on it] as soon as time on my project permits it."

> I used several months to hunt down errors in my grammar, when it all
> turned out to work OK as soon as I disabled the use of BitSets.

I'm not sure how it took you several months to look at the single IF  
statement and its bitset to figure out it was missing any lookahead.   
Surely a 0 bitset is obvious.

Terence


More information about the antlr-interest mailing list