-- file ProtoP1.mesa -- Last edited by Satterthwaite on January 10, 1983 2:36 pm DIRECTORY ParseTable: TYPE USING [ActionEntry, ProdDataRef, State, TableRef, TSymbol], Stream: TYPE USING [Handle], Strings: TYPE USING [String]; P1: DEFINITIONS={ OPEN ParseTable; -- pointer types ValueStack: TYPE~LONG POINTER TO P1.ValueSeq; StateStack: TYPE~LONG POINTER TO StateSeq; LinkStack: TYPE~LONG POINTER TO LinkSeq; ActionStack: TYPE~LONG POINTER TO ActionSeq; -- record structures (LONG does not occur past this point) Value: TYPE~RECORD [ -- type of the value stack SELECT OVERLAID * FROM scalar => [s: UNSPECIFIED], ref => [r: UNSPECIFIED] ENDCASE]; nullValue: P1.Value~[scalar[0]]; nullId: P1.Value~[ref[0]]; ValueSeq: TYPE~RECORD [SEQUENCE length: NAT OF P1.Value]; StateSeq: TYPE~RECORD [SEQUENCE length: NAT OF State]; LinkSeq: TYPE~RECORD [SEQUENCE length: NAT OF CARDINAL]; -- links to source text ActionSeq: TYPE~RECORD [SEQUENCE length: NAT OF ActionEntry]; Token: TYPE~RECORD [ class: TSymbol, -- the token class value: P1.Value, index: CARDINAL]; -- source line index -- implemented by scanner (see ProtoScanner.mesa) Atom: PROC RETURNS [Token]; ErrorContext: PROC [to: Stream.Handle, message: Strings.String, tokenIndex: CARDINAL]; InstallScanTable: PROC [ParseTable.TableRef]; ResetScanIndex: PROC [CARDINAL] RETURNS [success: BOOL]; ScanInit: PROC [ source: Stream.Handle, scratchZone: UNCOUNTED ZONE, logger: PROC [PROC [log: Stream.Handle]]]; ScanReset: PROC RETURNS [nTokens, nErrors: CARDINAL]; -- implemented by parser (see ProtoParser.mesa) InputLoc: PROC RETURNS [CARDINAL]; InstallParseTable: PROC [ParseTable.TableRef]; Parse: PROC [ source: Stream.Handle, scratchZone: UNCOUNTED ZONE, logger: PROC [PROC [log: Stream.Handle]]] RETURNS [complete: BOOL, nTokens, nErrors: CARDINAL]; ParserID: PROC RETURNS [Strings.String]; -- implemented by interpreter AssignDescriptors: PROC [ qd: P1.ActionStack, vd: P1.ValueStack, ld: P1.LinkStack, pp: ParseTable.ProdDataRef]; ProcessQueue: PROC [qI, top: CARDINAL]; TokenValue: PROC [TSymbol] RETURNS [P1.Value]; }.