-- file PPP1.Mesa
-- last modified by Satterthwaite, January 12, 1981  2:15 PM
-- last edit by Russ Atkinson, 29-May-81 16:57:50
-- last edited by Suzuki, 12-Nov-81 16:14:15

DIRECTORY
  PPCommentTable: TYPE USING [Index, Text],
  ParseTable: TYPE USING [ActionEntry, TableRef, ProdData, TSymbol],
  IOStream: TYPE USING [Handle],
  PPLeaves: TYPE USING [HTIndex];

PPP1: DEFINITIONS =
  BEGIN
  OPEN PPCommentTable, ParseTable, PPLeaves;

  Handle: TYPE = TableRef;
  ProdDataHandle: TYPE = LONG POINTER TO ProdData;
  
  Value: TYPE = RECORD [	-- type of the value stack
    s: UNSPECIFIED ← 0,	-- scalars only
    r: REF ANY ← NIL];

  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: Index];		-- source line index

 -- implemented by Scanner
  Atom: PROC RETURNS [Token];
  ErrorContext: PROC [to: IOStream.Handle, message: Text, tokenIndex: Index];
  IdOfFirst: PROC RETURNS [HTIndex];
  IdOfLock: PROC RETURNS [HTIndex];
  IdOfRest: PROC RETURNS [HTIndex];
  ResetScanIndex: PROC [Index] RETURNS [success: BOOLEAN];
  ScanInit: PROC [table: Handle];
  ScanReset: PROC RETURNS [nTokens, nErrors: CARDINAL];

 -- implemented by Parser
  Parse: PROC RETURNS [complete: BOOLEAN, nTokens, nErrors: CARDINAL];
  ParserID: PROC RETURNS [Text];
  InputLoc: PROC RETURNS [Index];

 -- implemented by Pass1T

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

  OpenTest, CloseTest: PROC;
  
  
 -- the global frames
  Scanner, Parser, Pass1T: PROGRAM;

  END.