[antlr-interest] Serious Bug when using BitSet generation-Forgot:
USING ANTLR 2.7.5 !!!!
Terence Parr
parrt at cs.usfca.edu
Sat Nov 5 16:57:37 PST 2005
Hi. I'm looking into this for 2.7.6 release imminent this weekish.
First, this is a bug in your grammar right:
> commonLibraryBlock3
> : {isCategory}? libraryDeclarations
> | {isCategory}? ( )
that 2nd production is impossible, right?
Now, you have a rule with:
| {isProgram}? ( ) **************** NOTE : These kind of
empty productions FAIL to match an empty Production when using BITSET
generation !
| {isCategory}? ( )
| {isConstants}? ( )
Now. "( )" is not necessary, so remove those; extra code is
generated I think.
Your intent is to have an if-then-else chain with predicates tested,
right? ANTLR should remove all lookahead for the last n-1
productions as the lookahead clearly is the FOLLOW(your rule) and
therefore identical for all n productions. I'm stunned there is any
lookahead even with no bitsets. ANTLR should delete all lookahead
for 2..n-1 productions. Seems to me it's a bug that it *does* work
without bitsets. I'm making an example.
Ter
More information about the antlr-interest
mailing list