file ProtoP1.mesa
Last edited by Satterthwaite on January 10, 1983 2:36 pm
Last Edited by: Maxwell, August 3, 1983 11:33 am
DIRECTORY
IO: TYPE USING [STREAM],
ParseTable: TYPE USING [ActionEntry, ProdDataRef, State, TableRef, TSymbol],
Rope: TYPE USING [ROPE];
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 scanner (see ProtoScanner.mesa)
Atom: PROC RETURNS [Token];
ErrorContext: PROC [to: IO.STREAM, message: Rope.ROPE, tokenIndex: CARDINAL];
InstallScanTable: PROC [ParseTable.TableRef];
ResetScanIndex: PROC [CARDINAL] RETURNS [success: BOOL];
ScanInit: PROC [
source: IO.STREAM,
scratchZone: UNCOUNTED ZONE,
logger: PROC [PROC [log: IO.STREAM]]];
ScanReset: PROC RETURNS [nTokens, nErrors: CARDINAL];
implemented by parser (see ProtoParser.mesa)
InputLoc: PROC RETURNS [CARDINAL];
InstallParseTable: PROC [ParseTable.TableRef];
Parse: PROC [
source: IO.STREAM,
scratchZone: UNCOUNTED ZONE,
logger: PROC [PROC [log: IO.STREAM]]]
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 [TSymbol] RETURNS [P1.Value];
}.