amirhossein-hkh / LR-Parser

LR Parser (LR(0), SLR(1), CLR(1) and LALR(1))

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

LR1State closure must merge lookaheads of matching items

rick-masters opened this issue · comments

In LR1State closure method, new items are created with lookaheads. In some cases, items may be created that differ only by lookahead sets. These states must be merged together otherwise duplicate transition will be created in LR1Parser and incorrect tables are created.

Reproducing this requires a large and complicated grammar and diagnostics that show the duplicate items and transitions. That would require more time to prepare than I have so I'll just be sending over another pull request with the fix.

Resolved by PR #5.