NPGS1.mesa
Copyright Ó 1985, 1988, 1992 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 25, 1988 7:38:27 pm PST
JKF February 6, 1989 12:15:52 pm PST
DIRECTORY
IO USING [STREAM],
NPGSParseTable USING [ActionEntry, ProdDataRef, State, TSymbol],
Rope USING [ROPE];
NPGS1: CEDAR DEFINITIONS ~ {
Index: TYPE~CARDINAL;
pointer types
ValueStack: TYPE~REF ValueSeq;
StateStack: TYPE~REF StateSeq;
LinkStack: TYPE~REF LinkSeq;
ActionStack: TYPE~REF ActionSeq;
record structures
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 Value];
nullValue: Value~[scalar[0]];
nullId: Value~[ref[0]];
StateSeq: TYPE~RECORD [SEQUENCE length: NAT OF NPGSParseTable.State];
LinkSeq: TYPE~RECORD [SEQUENCE length: NAT OF Index]; -- links to source text
ActionSeq: TYPE~RECORD [SEQUENCE length: NAT OF NPGSParseTable.ActionEntry];
Token: TYPE~RECORD [
class: NPGSParseTable.TSymbol, -- the token class
value: Value,
index: Index]; -- source line index
implemented by NPGSScan
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];
implemented by NPGSParser
InputLoc: PROC RETURNS [Index];
InstallParseTable: PROC;
Parse: PROC[
source: IO.STREAM,
logger: PROC [PROC [log: IO.STREAM]],
prefixOk: BOOL, cusp: BOOL]
RETURNS [complete: BOOL, nTokens, nErrors: CARDINAL];
ParserID: PROC RETURNS [Rope.ROPE];
implemented by NPGSScan
AssignDescriptors: PROC [
qd: ActionStack, vd: ValueStack, ld: LinkStack, pp: NPGSParseTable.ProdDataRef];
ProcessQueue: PROC [qI, top: CARDINAL, cusp: BOOL];
TokenValue: PROC [NPGSParseTable.TSymbol] RETURNS [Value];
}.