BEGIN OPEN Rope;
-- first the basic grammar stuff
Grammar: TYPE = REF GrammarBody;
GrammarBody: TYPE;
Symbol: TYPE = REF SymbolBody;
SymbolBody: TYPE;
Production: TYPE = REF ProductionBody;
ProductionBody: TYPE;
TerminalVariety: TYPE = {unique, generic};
BuildAGrammar: PROC[
genTheGrammar: PROC[
oneUniqueTerminal: PROC[name: ROPE, spelling: ROPE], -- spelling = NIL if the same spelling as name
oneGenericTerminal: PROC[name: ROPE, class: ROPE],
oneNonTerminal: PROC[name: ROPE],
oneLeftSide: PROC[ruleIndex: CARDINAL, symb: ROPE],
aRightSideSymb: PROC[ROPE]]]
RETURNS[Grammar];
GetStartProduction: PROC[Grammar] RETURNS[Production];
GetLength: PROC[Production] RETURNS[CARDINAL];
GetRightSideSymbol: PROC[Production, CARDINAL] RETURNS[Symbol];
GetLeftSideSymbol: PROC[Production] RETURNS[Symbol];
GenProductions: PROC[Grammar, PROC[Production]];
GenAllSymbols: PROC[Grammar, PROC[Symbol]];
GetSymbolText: PROC[Symbol] RETURNS[ROPE];
GetTerminalVariety: PROC[Symbol] RETURNS[TerminalVariety];
GetTerminalSpelling: PROC[Symbol] RETURNS[ROPE];
GetTerminalClass: PROC[Symbol] RETURNS[ROPE];
GetProductionIndex: PROC[Production] RETURNS[CARDINAL];
GetGrammarStats: PROC[grammar: Grammar] RETURNS[
nProductions, nRightSideItems, nTerminals, nNonTerminals: INT];
-- then the recorded info to help higher level code
NoteTerminalSeqCollection: PROC[Grammar, REF ANY];
GetTerminalSeqCollection: PROC[Grammar] RETURNS[REF ANY];
NoteTerminalSeq: PROC[Symbol, REF ANY];
GetTerminalSeq: PROC[Symbol] RETURNS[REF ANY];
NoteLR0ItemSetCollection: PROC[Grammar, REF ANY];
GetLR0ItemSetCollection: PROC[Grammar] RETURNS[REF ANY];
NoteFirstLR0Item: PROC[Production, REF ANY];
GetFirstLR0Item: PROC[Production] RETURNS[REF ANY];
NoteLR0ItemCollection: PROC[Grammar, REF ANY];
GetLR0ItemCollection: PROC[Grammar] RETURNS[REF ANY];
NoteAssociatedLR0Closure: PROC[Production, REF ANY];
GetAssociatedLR0Closure: PROC[Production] RETURNS[REF ANY];
NoteLR1ItemSetCollection: PROC[Grammar, REF ANY];
GetLR1ItemSetCollection: PROC[Grammar] RETURNS[REF ANY];
NoteAssociatedLR1Closure: PROC[Production, REF ANY];
GetAssociatedLR1Closure: PROC[Production] RETURNS[REF ANY];
-- then the derivitive procedures
PrepareTheGrammar: PROC[Grammar];
TestIfTerminal: PROC[Symbol] RETURNS[BOOLEAN];
GetNTerminalSymbols: PROC[Grammar] RETURNS[CARDINAL];
GenTerminalSymbols: PROC[Grammar, PROC[Symbol]];
GenProductionsForSymbol: PROC[Symbol, PROC[Production]];
TestCanProduceEmpty: PROC[Symbol] RETURNS[BOOLEAN];
GenCanBeFirst: PROC[Symbol, PROC[Symbol]]; -- code is currently in LR1ItemSetsImpl
END..