ProtoP1.mesa
Copyright © 1985 by Xerox Corporation. All rights reserved.
Satterthwaite on February 4, 1986 2:18:31 pm PST
Maxwell, August 3, 1983 11:33 am
Paul Rovner, September 22, 1983 10:37 pm
Russ Atkinson (RRA) March 7, 1985 0:03:14 am PST
DIRECTORY
IO: TYPE USING [STREAM],
ParseTable: TYPE USING [ActionEntry, ProdDataRef, State, TableRef, TSymbol],
Rope: TYPE USING [ROPE];
P1: DEFINITIONS ~ {
Index: TYPE~CARDINAL;
pointer types
ValueStack: TYPE~REF ValueSeq;
StateStack: TYPE~REF StateSeq;
LinkStack: TYPE~REF LinkSeq;
ActionStack: TYPE~REF 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];
ValueSeq: TYPE~RECORD[SEQUENCE length: NAT OF P1.Value];
nullValue: P1.Value~[scalar[0]];
nullId: P1.Value~[ref[0]];
StateSeq: TYPE~RECORD [SEQUENCE length: NAT OF ParseTable.State];
LinkSeq: TYPE~RECORD [SEQUENCE length: NAT OF P1.Index]; -- links to source text
ActionSeq: TYPE~RECORD [SEQUENCE length: NAT OF ParseTable.ActionEntry];
Token: TYPE~RECORD [
class: ParseTable.TSymbol,  -- the token class
value: P1.Value,
index: P1.Index];     -- source line index
implemented by scanner (see ProtoScanner.mesa)
ErrorContext: PROC[to: IO.STREAM, message: Rope.ROPE, tokenIndex: P1.Index];
InstallScanTable: PROC[ParseTable.TableRef];
NextToken: PROC RETURNS[Token];
ResetScanIndex: PROC[P1.Index] RETURNS[success: BOOL];
ScanInit: PROC[
source: IO.STREAM,
logger: PROC[PROC[log: IO.STREAM]]];
ScanReset: PROC;
ScanStats: PROC RETURNS[nTokens, nErrors: CARDINAL];
implemented by parser (see ProtoParser.mesa)
InputLoc: PROC RETURNS [P1.Index];
InstallParseTable: PROC [ParseTable.TableRef];
Parse: PROC[
source: IO.STREAM,
logger: PROC[PROC[log: IO.STREAM]],
prefixOk: BOOL]
RETURNS[complete: BOOL, nTokens, nErrors: CARDINAL];
ParserID: PROC RETURNS[Rope.ROPE];
implemented by interpreter
AssignDescriptors: PROC [
qd: P1.ActionStack, vd: P1.ValueStack, ld: P1.LinkStack, pp: ParseTable.ProdDataRef];
ProcessQueue: PROC [qI, top: CARDINAL];
TokenValue: PROC [ParseTable.TSymbol] RETURNS [P1.Value];
}.