Skip to content

ISSUE 352: Fix extra initial LR(0) seed in genLR0items#353

Open
marco-comini wants to merge 1 commit intohaskell:masterfrom
marco-comini:fix-extra-lr0-seed
Open

ISSUE 352: Fix extra initial LR(0) seed in genLR0items#353
marco-comini wants to merge 1 commit intohaskell:masterfrom
marco-comini:fix-extra-lr0-seed

Conversation

@marco-comini
Copy link

Fixes #352.

This patch fixes an off-by-one bug in genLR0items.

Previously, the initial LR(0) kernels were seeded with:

[0 .. n_starts]

where n_starts = length (starts g).

This caused one extra initial seeded component to be generated. Consequently, Happy could introduce many additional states coming from the first ordinary grammar production, even when that production was unrelated to the declared entry point.

This patch changes the seed range so that only the intended start rules are used.

I also added a regression test (tests/issue352.y).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Possible off-by-one in genLR0items startRules

1 participant