[ivy]<Satterthwaite>Poplar>PL.Mesa!5

PL.Mesa
Copyright (c) Xerox Corporation, 1982. All rights reserved.
last modifed by Schmidt August 22, 1982 2:22 pm
last modified by Satterthwaite, April 18, 1986 4:40:56 pm PST
DIRECTORY
IO: TYPE USING [STREAM],
PString: TYPE USING [Stream],
Rope: TYPE USING [ROPE];
PL: CEDAR DEFINITIONS = {
IS, OS, ES: IO.STREAM;
Z: ZONE;
NodeType: TYPE = {ZERO,ID,STR,NUM, HOLE,LST,CAT,GTR,PAPPLY,FCN, ASS,
PROG,FAIL,SEQOF,OPT, SEQOFC, DELETE, MAPPLY,
UNARY,PLUS,MINUS,GOBBLE,PALT,
SEQ, CATL,WILD, PATTERN,ITER,TILDE,EQUAL, ENV,
CLOSURE,COMB, UNDEFINED};
Node: TYPE = REF NodeRecord;
NodeRecord: TYPE = RECORD[
e: BOOL ← FALSE,-- if TRUE, this node has been eval'ed
Var: SELECT Type: NodeType FROM
base
ID => [name: Symbol],
STR => [str: Rope.ROPE],
NUM => [num: INT],
FAIL, WILD, HOLE,UNDEFINED => [ ],
inductive
COMB => [proc: Symbol, parm: Node],
ASS => [lhs: Symbol, rhs: Node],
LST => [listhead: Node, listtail: LSTNode],
CAT,CATL,EQUAL, GTR, PALT, PAPPLY, MAPPLY,
GOBBLE, ITER, PROG, PLUS, MINUS, SEQ
=> [left,right: Node],
FCN => [parms, fcn: Node],
SEQOF, SEQOFC, OPT, DELETE => [pat: Node],
PATTERN=> [pattern:Node],
TILDE => [not: Node],
CLOSURE => [exp: Node, env: Environment],
ENDCASE
];
LSTNodeRecord: TYPE = NodeRecord.LST;
LSTNode: TYPE = REF LSTNodeRecord;
rID: TYPE = REF NodeRecord.ID;
rSTR: TYPE = REF NodeRecord.STR;
rNUM: TYPE = REF NodeRecord.NUM;
rFAIL: TYPE = REF NodeRecord.FAIL;
rWILD: TYPE = REF NodeRecord.WILD;
rHOLE: TYPE = REF NodeRecord.HOLE;
rUNDEFINED: TYPE = REF NodeRecord.UNDEFINED;
rCOMB: TYPE = REF NodeRecord.COMB;
rASS: TYPE = REF NodeRecord.ASS;
rLST: TYPE = REF NodeRecord.LST;
rCAT: TYPE = REF NodeRecord.CAT;
rCATL: TYPE = REF NodeRecord.CATL;
rEQUAL: TYPE = REF NodeRecord.EQUAL;
rGTR: TYPE = REF NodeRecord.GTR;
rPALT: TYPE = REF NodeRecord.PALT;
rPAPPLY: TYPE = REF NodeRecord.PAPPLY;
rMAPPLY: TYPE = REF NodeRecord.MAPPLY;
rGOBBLE: TYPE = REF NodeRecord.GOBBLE;
rITER: TYPE = REF NodeRecord.ITER;
rPROG: TYPE = REF NodeRecord.PROG;
rPLUS: TYPE = REF NodeRecord.PLUS;
rMINUS: TYPE = REF NodeRecord.MINUS;
rSEQ: TYPE = REF NodeRecord.SEQ;
rFCN: TYPE = REF NodeRecord.FCN;
rSEQOF: TYPE = REF NodeRecord.SEQOF;
rSEQOFC: TYPE = REF NodeRecord.SEQOFC;
rOPT: TYPE = REF NodeRecord.OPT;
rDELETE: TYPE = REF NodeRecord.DELETE;
rPATTERN: TYPE = REF NodeRecord.PATTERN;
rTILDE: TYPE = REF NodeRecord.TILDE;
rCLOSURE: TYPE = REF NodeRecord.CLOSURE;
Environment: TYPE = REF ERecord;
ERecord: TYPE =
RECORD[name: Symbol, val: Node, next: Environment];
Symbol: TYPE = REF SymbolRecord;
SymbolRecord: TYPE = RECORD[
name: Rope.ROPE ← NIL,
son: ARRAY [0..1] OF Symbol ← ALL[NIL],
x: SELECT t: * FROM
VALUE => [v: Node],
ZARY => [p: PROC[Node] RETURNS[Node]],
UNARY => [p: PROC[Node,Node] RETURNS[Node]],
PFUNC => [p: PROC[PString.Stream] RETURNS[Node, PString.Stream]],
PFUNC1 => [p: PROC[PString.Stream,Node]
RETURNS[Node, PString.Stream]],
ENDCASE
];
rVAL: TYPE = REF SymbolRecord.VALUE;
rZARY: TYPE = REF SymbolRecord.ZARY;
rUNARY: TYPE = REF SymbolRecord.UNARY;
rPFUNC: TYPE = REF SymbolRecord.PFUNC;
rPFUNC1: TYPE = REF SymbolRecord.PFUNC1;
NumLines: CARDINAL = 35;
NumPages: CARDINAL = 35;
sSize: CARDINAL = 500;
cdebug: BOOL = FALSE;
defined in PLSupImpl.Mesa
PBug: SIGNAL[est: Rope.ROPE];
SErr: SIGNAL[est: Rope.ROPE];
RErr: SIGNAL[est: Rope.ROPE];
EndDisplay: SIGNAL;
Interrupt: SIGNAL;
defined in PLParseImpl.mesa
ParseSetup: PROC;
Dist: PROC[Rope.ROPE] RETURNS[Node];
SetCurrentNode: PROC[Node];
defined in PLEvalImpl.mesa
EQ: PROC[Rope.ROPE, Rope.ROPE] RETURNS [BOOL];
Equal: PROC[Node, Node] RETURNS[BOOL];
SN: PROC[Rope.ROPE] RETURNS[Node];
BlessString: PROC[Node] RETURNS[Rope.ROPE];
BlessLST: PROC[Node] RETURNS[LSTNode];
PtoR: PROC[LONG POINTER] RETURNS[REF];
Eval: PROC[Node,Environment] RETURNS[Node];
MapList: PROC[LSTNode,PROC[Node] RETURNS[Node]] RETURNS[LSTNode];
Map: PROC[LSTNode,PROC[Node]] ;
LengthList: PROC[LSTNode] RETURNS[CARDINAL];
NewNail: PROC RETURNS[LSTNode];
defined in PLSupImpl.mesa
SupSetup: PROC;
SupReset: PROC;
defined in PLStoreImpl.mesa
Preorder: PROC[Node, PROC[Node]RETURNS[BOOL]];
ParseTree: PROC[Node];
Insert: PROC[Rope.ROPE, SymbolRecord] RETURNS[Symbol];
Lookup: PROC[Rope.ROPE] RETURNS[Symbol];
StoreSetup: PROC;
StoreReset: PROC;
StoreCleanup: PROC;
GetSpecialNodes: PROC RETURNS[rFAIL,rSTR,LSTNode];
}.