MimP1.mesa
Copyright Ó 1985, 1987, 1988, 1991 by Xerox Corporation. All rights reserved.
Satterthwaite, June 5, 1986 2:00:58 pm PDT
Russ Atkinson (RRA) March 17, 1988 12:50:28 pm PST
DIRECTORY
IO USING [STREAM],
ParseTable USING [ActionEntry, ProdDataRef, State, TSymbol],
Rope USING [ROPE],
Symbols USING [Name],
Table USING [Index];
MimP1:
DEFINITIONS = {
OPEN ParseTable;
Index: TYPE = INT; -- FileStream.FileByteIndex
ref types
ValueStack: TYPE = REF ValueSeq;
StateStack: TYPE = REF StateSeq;
LinkStack: TYPE = REF LinkSeq;
ActionStack: TYPE = REF ActionSeq;
record structures (LONG or REF does not occur past this point)
Value:
TYPE =
RECORD [
type of the value stack
SELECT
OVERLAID *
FROM
scalar => [sb: BOOL, sn: INTEGER],
ref => [r: Table.Index]
ENDCASE];
ValueSeq: TYPE = RECORD [SEQUENCE length: NAT OF MimP1.Value];
nullValue: MimP1.Value = [scalar[FALSE, 0]];
nullId: MimP1.Value = [ref[Table.Index.FIRST]];
StateSeq: TYPE = RECORD [SEQUENCE length: NAT OF ParseTable.State];
LinkSeq: TYPE = RECORD [SEQUENCE length: NAT OF MimP1.Index]; -- links to source text
ActionSeq: TYPE = RECORD [SEQUENCE length: NAT OF ParseTable.ActionEntry];
Token:
TYPE =
RECORD [
class: ParseTable.TSymbol, -- the token class
value: MimP1.Value,
index: MimP1.Index]; -- source line index
implemented by Pass1
IdOfFirst: PROC RETURNS [Symbols.Name];
IdOfLock: PROC RETURNS [Symbols.Name];
IdOfRest: PROC RETURNS [Symbols.Name];
implemented by MimScanner
ErrorContext: PROC [to: IO.STREAM, message: Rope.ROPE, tokenIndex: MimP1.Index];
InstallScanTable: PROC;
NextToken: PROC RETURNS [Token];
ResetScanIndex: PROC [MimP1.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 MimParserImpl
InputLoc: PROC RETURNS [MimP1.Index];
InstallParseTable: PROC;
Parse: PROC [source: IO.STREAM, logger: PROC [PROC [log: IO.STREAM]], prefixOk: BOOL]
RETURNS [complete: BOOL, nTokens, nErrors: CARDINAL];
implemented by TreeBuild (Pass1T)
AssignDescriptors: PROC
[qd: ActionStack, vd: ValueStack, ld: LinkStack, pp: ParseTable.ProdDataRef];
ProcessQueue: PROC [qI, top: CARDINAL];
TokenValue: PROC [ParseTable.TSymbol] RETURNS [MimP1.Value];
}.