-- file P1.Mesa -- last modified by Satterthwaite, 27-Oct-81 14:31:31 DIRECTORY ParseTable: TYPE USING [ActionEntry, ProdDataRef, State, TableRef, TSymbol], Stream: TYPE USING [Handle], Strings: TYPE USING [String], Symbols: TYPE USING [HTIndex]; 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 Pass1 IdOfFirst: PROC RETURNS [Symbols.HTIndex]; IdOfLock: PROC RETURNS [Symbols.HTIndex]; IdOfRest: PROC RETURNS [Symbols.HTIndex]; -- implemented by Scanner Atom: PROC RETURNS [Token]; ErrorContext: PROC [to: Stream.Handle, message: Strings.String, tokenIndex: CARDINAL]; ResetScanIndex: PROC [CARDINAL] RETURNS [success: BOOLEAN]; ScanInit: PROC [table: ParseTable.TableRef]; ScanReset: PROC RETURNS [nTokens, nErrors: CARDINAL]; -- implemented by Parser Parse: PROC RETURNS [complete: BOOLEAN, nTokens, nErrors: CARDINAL]; ParserID: PROC RETURNS [Strings.String]; InputLoc: PROC RETURNS [CARDINAL]; -- implemented by Pass1T 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]; }.