-- file SMP1.mesa -- last modified by Satterthwaite, July 29, 1983 9:32 am -- last edit by Schmidt, May 3, 1982 4:28 pm DIRECTORY IO: TYPE USING [STREAM], SMParseTable: TYPE ParseTable USING [ActionEntry, ProdDataRef, State, TableRef, TSymbol], SMCommentTable: TYPE USING [Index, Text], SMOps: TYPE USING [MS]; SMP1: CEDAR DEFINITIONS ~ { OPEN SMParseTable; Index: TYPE~SMCommentTable.Index; -- ref types ValueStack: TYPE~REF ValueSeq; StateStack: TYPE~REF StateSeq; LinkStack: TYPE~REF LinkSeq; ActionStack: TYPE~REF ActionSeq; -- record structures TValue: TYPE ~ REF ANY←NIL; -- value of terminal symbol NTValue: TYPE ~ CARDINAL←0; -- value of nonterminal Value: TYPE~RECORD[ -- type of the value stack t: TValue, -- refs (ATOMS, etc.) n: NTValue]; -- scalars (counts, flags, etc.) ValueSeq: TYPE~RECORD[SEQUENCE length: NAT OF Value]; nullTValue: TValue ~ NIL; nullNTValue: NTValue ~ NTValue.LAST; nullValue: Value ~ []; nullId: Value ~ nullValue; StateSeq: TYPE~RECORD[SEQUENCE length: NAT OF State]; LinkSeq: TYPE~RECORD[SEQUENCE length: NAT OF Index]; -- links to source text ActionSeq: TYPE~RECORD[SEQUENCE length: NAT OF ActionEntry]; Token: TYPE~RECORD[ class: TSymbol, -- the token class value: TValue, -- value index: Index]; -- source stream index -- implemented by scanner Atom: PROC RETURNS[Token]; ErrorContext: PROC[message: SMCommentTable.Text, tokenIndex: Index]; InstallScanTable: PROC[TableRef]; ResetScanIndex: PROC[Index] RETURNS[success: BOOL]; ScanInit: PROC[model: SMOps.MS, source: IO.STREAM]; ScanReset: PROC RETURNS[nTokens, nErrors: CARDINAL]; -- implemented by parser InputLoc: PROC RETURNS[Index]; InstallParseTable: PROC[TableRef]; Parse: UNSAFE PROC[model: SMOps.MS, source: IO.STREAM, prefix: BOOL←FALSE] RETURNS[complete: BOOL, nTokens, nErrors: CARDINAL]; -- implemented by tree builder AssignDescriptors: PROC[ qd: ActionStack, vd: ValueStack, ld: LinkStack, pp: ProdDataRef, model: SMOps.MS]; ProcessQueue: PROC[qI, top: CARDINAL]; TokenValue: PROC[TSymbol] RETURNS[TValue]; }.