-- file PGS1.mesa
-- last modified by Satterthwaite, 22-Feb-82 12:22:26

DIRECTORY
  ParseTable: FROM "PGSParseTable" USING [
    ActionEntry, ProdDataRef, State, Symbol, TableRef, TSymbol];

PGS1: DEFINITIONS = {
  OPEN ParseTable;

 -- pointer types
 
  ValueStack: TYPE = LONG POINTER TO  PGS1.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 = CARDINAL;

  ValueSeq: TYPE = RECORD [SEQUENCE length: NAT OF PGS1.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: PGS1.Value,
    index: CARDINAL];		-- source line index

 -- implemented by PGSScan
  Atom: PROC RETURNS [Token];
  ResetScanIndex: PROC [CARDINAL];
  ScanInit: PROC [ParseTable.TableRef];
  ScanReset: PROC [pErrors:CARDINAL] RETURNS [nTokens, nErrors: CARDINAL];
  AssignDescriptors: PROC [
	qd: PGS1.ActionStack,
	vd: PGS1.ValueStack,
	ld: PGS1.LinkStack,
	pp: ParseTable.ProdDataRef];
  ProcessQueue: PROC [qI, top: CARDINAL];
  TokenValue: PROC [TSymbol] RETURNS [UNSPECIFIED];

 -- implemented by PGSParse
  Parse: PROC [ParseTable.TableRef]
    RETURNS [complete: BOOLEAN, nTokens, nErrors: CARDINAL];
  InputLoc: PROC RETURNS [CARDINAL];

 -- implemented by PGSControl

  ErrorContext: PROC [STRING, CARDINAL];
  LocateIndex: PROC [index: CARDINAL] RETURNS [CARDINAL];

  }.