-- file CtoSP1.mesa -- last modified by Satterthwaite, July 29, 1983 9:32 am DIRECTORY CtoSParseTable: TYPE ParseTable USING [ActionEntry, ProdDataRef, State, TableRef, TSymbol], IO: TYPE USING [STREAM], Rope: TYPE USING [ROPE], SMCommentTable: TYPE USING [Index, Text], SMOps: TYPE USING [MS]; CtoSP1: CEDAR DEFINITIONS ~ { OPEN CtoSParseTable; 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 ~ INT←0; -- value of terminal symbol NTValue: TYPE ~ REF ANY←NIL; -- value of nonterminal Value: TYPE~RECORD[ -- type of the value stack t: TValue, -- length of token for terminals n: NTValue]; -- lists or Tree.Link for nonterminals ValueSeq: TYPE~RECORD[SEQUENCE length: NAT OF Value]; nullTValue: TValue ~ -1; nullNTValue: NTValue ~ NIL; 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]; Substr: PROC[start, length: Index] RETURNS[Rope.ROPE]; -- implemented by parser InputLoc: PROC RETURNS[Index]; InstallParseTable: PROC[TableRef]; Parse: UNSAFE PROC[model: SMOps.MS, source: IO.STREAM, prefix: BOOL←TRUE] 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]; }.