DIRECTORY
GrammarBasic USING[Grammar, Symbol],
LR0ItemSetsBasic USING[LR0Item, TentativeLR0ItemSet, LR0ItemSet, CreateEmptyTentativeLR0ItemSet, InsertItemInTentativeLR0ItemSet, FreezeTentativeLR0ItemSet, GenItemsInLR0ItemSet],
LR0Items USING[GenV0EpsilonKernelItems, GenKernelGoTo0Items, GenClose0Items],
LR0ItemSets USING[];
LR0ItemSetsImpl: CEDAR PROGRAM IMPORTS LR0ItemSetsBasic, LR0Items EXPORTS LR0ItemSets =
BEGIN OPEN GrammarBasic, LR0ItemSetsBasic, LR0Items;
CreateV0EpsilonKernel: PUBLIC PROC[grammar: Grammar] RETURNS[LR0ItemSet] =
BEGIN
tentativeSet: TentativeLR0ItemSet ← CreateEmptyTentativeLR0ItemSet[grammar];
InsertOne: PROC[item: LR0Item] =
{[] ← InsertItemInTentativeLR0ItemSet[tentativeSet, item]};
GenV0EpsilonKernelItems[grammar, InsertOne];
RETURN[FreezeTentativeLR0ItemSet[tentativeSet]];
END;
GenKernelGoToLR0ItemsFromKernel: PUBLIC PROC[set: LR0ItemSet, for: PROC[Symbol, LR0Item]] =
BEGIN
HandleOneItemInClosure: PROC[item: LR0Item] =
{GenKernelGoTo0Items[item, for]};
HandleOneKernelItem: PROC[item: LR0Item] =
{GenClose0Items[item, HandleOneItemInClosure]};
GenItemsInLR0ItemSet[set, HandleOneKernelItem];
END;
END..