-- TerminalSequences.mesa
-- last edit November 5, 1984 12:50:18 pm PST
-- Sturgis, March 12, 1986 11:14:25 am PST
DIRECTORY
GrammarBasic USING[Grammar, Symbol];
TerminalSequences: CEDAR DEFINITIONS =
BEGIN OPEN GrammarBasic;
TerminalSeq: TYPE = REF TerminalSeqBody;
TerminalSeqBody: TYPE;
TerminalSeqSet: TYPE = REF TerminalSeqSetBody;
TerminalSeqSetBody: TYPE;
CreateEmptyTerminalSeqSet: PROC[Grammar] RETURNS[TerminalSeqSet];
TestIfTerminalSeqInSet: PROC[TerminalSeqSet, TerminalSeq] RETURNS[BOOLEAN];
InsertTerminalSeqInSet: PROC[TerminalSeqSet, TerminalSeq] RETURNS[notPreviouslyPresent: BOOLEAN];
RemoveTerminalSeqFromSet: PROC[TerminalSeqSet, TerminalSeq];
TestIfTerminalSeqSetEmpty: PROC[TerminalSeqSet] RETURNS[BOOLEAN];
GenTerminalSeqsFromSet: PROC[TerminalSeqSet, PROC[TerminalSeq]];
FreezeTerminalSeqSet: PROC[TerminalSeqSet] RETURNS[TerminalSeqSet, --hash code-- CARDINAL];
TestIfEmptySeqInSet: PROC[TerminalSeqSet] RETURNS[BOOLEAN];
GetOneSymbolTerminalSeq: PROC[Symbol] RETURNS[TerminalSeq];
GetEmptyTerminalSeq: PROC[Grammar] RETURNS[TerminalSeq];
GetSymbolFromTerminalSeq: PROC[TerminalSeq] RETURNS[Symbol]; -- NIL if empty seq
GenFirstNonEmptyTerminalSeqs: PROC[Symbol, PROC[TerminalSeq]];
GetSetOfExactlyTheEmptyTermSeq: PROC[Grammar] RETURNS[TerminalSeqSet];
GetWithEmptyTerminalSeqRemoved: PROC[TerminalSeqSet] RETURNS[TerminalSeqSet];
CompareTwoTerminalSeqSets: PROC[TerminalSeqSet, TerminalSeqSet] RETURNS[BOOLEAN];
-- following support working with sets of terminal sequences as a whole
InsertTermSeqSetInSet: PROC[add: TerminalSeqSet, to: TerminalSeqSet] RETURNS[--some new ones-- BOOLEAN];
CompareTermSeqSetWithSet: PROC[testThese: TerminalSeqSet, with: TerminalSeqSet] RETURNS[--diff--TerminalSeqSet]; --diff are those elements in "test these" and not in "with", NIL if empty
TestNonEmptyIntersection: PROC[a, b: TerminalSeqSet] RETURNS[--nonEmpty-- BOOLEAN];
END..