-- PPP1.Mesa
-- Russ Atkinson, August 6, 1982 11:10 am

DIRECTORY
PPParseTable USING [ActionEntry, Handle, ProdDataHandle, TSymbol],
PPLeaves USING [HTIndex],
Rope USING [ROPE];

PPP1: CEDAR DEFINITIONS = BEGIN
OPEN PPParseTable, PPLeaves, Rope;

Value: TYPE = RECORD [ -- type of the value stack
s: UNSPECIFIED ← 0, -- scalars only
r: REF ANYNIL];

ValueSeq: TYPE = RECORD [SEQUENCE length: NAT OF Value];
ValueStack: TYPE = REF ValueSeq;

NullValue: Value = [s:0, r:NIL];
NullId: Value = NullValue;

Token: TYPE = RECORD [
class: TSymbol,  -- the token class
value: Value,
index: INT];  -- source line index

-- implemented by Scanner
Atom: PROC RETURNS [Token];
ErrorContext: PROC [message: ROPE, tokenIndex: INT];
IdOfFirst: PROC RETURNS [HTIndex];
IdOfLock: PROC RETURNS [HTIndex];
IdOfRest: PROC RETURNS [HTIndex];
ResetScanIndex: PROC [INT] RETURNS [success: BOOL];
ScanInit: UNSAFE PROC [table: Handle];
ScanReset: PROC RETURNS [nTokens, nErrors: CARDINAL];

-- implemented by Parser
Parse: PROC RETURNS [complete: BOOL, nTokens, nErrors: CARDINAL];
ParserID: PROC RETURNS [ROPE];
InputLoc: PROC RETURNS [INT];

-- implemented by Pass1T

AssignDescriptors: UNSAFE PROC [
 qd: LONG DESCRIPTOR FOR ARRAY OF ActionEntry,
 vd: ValueStack,
 ld: LONG DESCRIPTOR FOR ARRAY OF INT,
 pp: ProdDataHandle];
ProcessQueue: UNSAFE PROC [qI, top: CARDINAL];
TokenValue: UNSAFE PROC [TSymbol] RETURNS [Value];

-- the global frames
Scanner, Parser, Pass1T: PROGRAM;

END.