-- LR1ItemSetsBasic.mesa
-- last edit November 5, 1984 9:52:43 am PST
DIRECTORY
GrammarBasic USING[Grammar],
TerminalSequences USING[TerminalSeq, TerminalSeqSet],
LR0ItemSetsBasic USING[LR0Item];
LR1ItemSetsBasic: CEDAR DEFINITIONS =
BEGIN OPEN GrammarBasic, TerminalSequences, LR0ItemSetsBasic;
-- this interface contains facilities needed by the algorithms supporting the LR1Items interface. I have split up the LR1ItemSets code into two groups, the basic stuff is here, but the routines needed by the higher level algorithms are in LR1ItemSets, whose implementation uses LR1Items as well as LR1ItemSetsBasic.
-- Thus, LR1ItemSetsImpl uses LR1Items, and LR1ItemsImpl uses LR1ItemSetsBasic.
LR1Item: TYPE = RECORD[lr0Item: LR0Item, terminalSeq: TerminalSeq];
LR1ItemSet: TYPE = REF LR1ItemSetBody;
LR1ItemSetBody: TYPE;
LR1ItemSubset: TYPE = RECORD[lr0Item: LR0Item, terminals: TerminalSeqSet];
ClearLR1ItemSetsAssociatedNodes: PROC[Grammar];
MarkExistingLR1ItemSets: PROC[Grammar];
ForgetUnmarkedLR1ItemSets: PROC[Grammar];
CreateEmptyLR1ItemSet: PROC[Grammar] RETURNS[LR1ItemSet];
InsertItemInLR1ItemSet: PROC[LR1ItemSet, LR1Item] RETURNS[--newItem-- BOOLEAN];
-- (enters as dirty, if new item)
InsertSubsetInLR1ItemSet: PROC[insert: LR1ItemSubset, into: LR1ItemSet] RETURNS[--someNew-- BOOLEAN];
-- (new items enter as dirty)
GenerateDirtyItemsFromLR1ItemSet: PROC[LR1ItemSet, PROC[LR1Item]];
-- (they become clean)
GenerateDirtySubsetsFromLR1ItemSet: PROC[LR1ItemSet, PROC[LR1ItemSubset]];
-- (they become clean)
FreezeLR1ItemSet: PROC[set: LR1ItemSet, allowDirty: BOOLEAN] RETURNS[LR1ItemSet];
TestIfLR1ItemSetFrozen: PROC[set: LR1ItemSet] RETURNS[BOOLEAN];
GenerateItemsFromLR1ItemSet: PROC[LR1ItemSet, PROC[LR1Item]];
GenerateSubsetsFromLR1ItemSet: PROC[set: LR1ItemSet, for: PROC[LR1ItemSubset], notFrozenOK: BOOLEAN ← FALSE];
SetLR1AssociatedNode: PROC[LR1ItemSet, REF ANY];
GetLR1AssociatedNode: PROC[LR1ItemSet] RETURNS[REF ANY];
NarrowLR1ItemSet: PROC[REF ANY] RETURNS[LR1ItemSet];
CheckAnLR1ItemSet: PROC[ref: REF ANY];
CompareTwoLR1ItemSets: PROC[REF ANY, REF ANY] RETURNS[--equal contents-- BOOLEAN];
END..