MobP1.mesa
Copyright Ó 1985, 1989, 1991 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
Andy Litman March 18, 1988 9:33:21 pm PST
JKF July 22, 1989 3:48:29 pm PDT
DIRECTORY
IO USING [STREAM],
MobParseTable USING [ActionEntry, ProdDataRef, State, TSymbol],
Rope USING [ROPE];
MobP1:
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: LONG UNSPECIFIED],
ref => [r: LONG UNSPECIFIED],
short => [a, fill: UNSPECIFIED],
ENDCASE];
ValueSeq: TYPE~RECORD[SEQUENCE length: NAT OF Value];
nullValue: Value~[scalar[0]];
nullId: Value~[ref[0]];
StateSeq: TYPE~RECORD [SEQUENCE length: NAT OF MobParseTable.State];
LinkSeq: TYPE~RECORD [SEQUENCE length: NAT OF Index]; -- links to source text
ActionSeq: TYPE~RECORD [SEQUENCE length: NAT OF MobParseTable.ActionEntry];
Token:
TYPE~
RECORD [
class: MobParseTable.TSymbol, -- the token class
value: Value,
index: Index]; -- source line index
implemented by scanner (see ProtoScanner.mesa)
ErrorContext: PROC[to: IO.STREAM, message: Rope.ROPE, tokenIndex: Index];
InstallScanTable: PROC[];
NextToken: PROC RETURNS[Token];
ResetScanIndex: PROC[Index] RETURNS[success: BOOL];
ScanInit:
PROC[
source: IO.STREAM,
logger: PROC[PROC[log: IO.STREAM]]];
ScanReset: PROC;
ScanStats: PROC RETURNS[nTokens, nErrors: CARDINAL];
TypeSym: PROC[log: IO.STREAM, sym: MobParseTable.TSymbol];
implemented by parser (see ProtoParser.mesa)
InputLoc: PROC RETURNS [Index];
InstallMobParseTable: PROC [];
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: ActionStack, vd: ValueStack, ld: LinkStack, pp: MobParseTable.ProdDataRef];
ProcessQueue: PROC [qI, top: CARDINAL];
TokenValue: PROC [MobParseTable.TSymbol] RETURNS [Value];