This directory contains small LangForge specs used by ../../doc/parser-algorithms.md.
The lr1-not-slr-* fixtures use the classic LR(1)-but-not-SLR example:
S : L Eq R | R ;
L : Star R | ID ;
R : L ;
The mysterious-conflict-* fixtures use a grammar that is LR(1), but where
plain LALR merging combines lookaheads that should remain separate:
Def : ParamSpec ReturnSpec Comma ;
ParamSpec : Type | NameList Colon Type ;
ReturnSpec : Type | Name Colon Type ;
Type : ID ;
Name : ID ;
NameList : Name | Name Comma NameList ;
Run:
make testExpected behavior:
lr1-not-slr-lalr.lfvalidates.lr1-not-slr-ielr.lfvalidates and keeps the same compact state shape as LALR.lr1-not-slr-canonical.lfvalidates.lr1-not-slr-slr.lfreports the expected SLR conflict.mysterious-conflict-ielr.lfvalidates.mysterious-conflict-canonical.lfvalidates.mysterious-conflict-lalr.lfreports the expected LALR merge conflict.
To see why IELR split or kept a core merge, inspect the IELR fixture:
go run ../../cmd/lang-forge inspect --spec mysterious-conflict-ielr.lf --format textThe report includes LALR/IELR/canonical state counts and the accepted/rejected merge decisions for the LR(0) cores that differ from plain LALR.