RoseTranslateRead.Mesa
Last Edited by: Spreitzer, September 28, 1984 8:18:28 pm PDT
Last Edited by: Barth, March 8, 1983 10:43 am
Last Edited by: Gasbarro, August 16, 1984 3:42:16 pm PDT
DIRECTORY AMTypes, Convert, IO, OpPrecParse, OrderedSymbolTableRef, ProcessExtras, Rope, RoseTranslateTypes, RoseTranslateInsides, SignalTypeRegistration, TextNode, TiogaStreams;
RoseTranslateRead:
CEDAR
PROGRAM
IMPORTS Convert, IO, OPP: OpPrecParse, OSTR: OrderedSymbolTableRef, ProcessExtras, Rope, RoseTranslateTypes, RoseTranslateInsides, SignalTypeRegistration, TS: TiogaStreams
EXPORTS RoseTranslateInsides =
BEGIN OPEN RoseTranslateTypes, RoseTranslateInsides;
wasRef: PUBLIC WasRef ← NEW [WasRefRep ← ["was module reference"]];
arglikeError, oplikeError: OPP.Token;
ops: SymbolTable ← OSTR.CreateTable[CompareOps];
dashClass, assertClass, arrowClass, colonClass, ltClass, gtClass, eqClass, commaClass, lambdaClass, returnClass, squareClass, applClass, rsClass, semiClass, cellClass, cellEndClass, nameClass, portsProcClass, applyClass, stateClass, initStateClass, ioCreatorClass, ioRefTypeClass, initializerClass, expandClass, portsClass, cedarClass, bbTestClass, stTestClass, initCTPropsClass, errorClass, directoryClass, importsClass, openClass, libClass, noisyErrClass, myArgClass: PUBLIC TokenClass;
evalClasses: ARRAY EvalType OF TokenClass;
autoName: Op ← NIL;
evalKeywords: ARRAY EvalType OF ROPE = ["ValsChanged", "InitQ", "PropQ", "InitUD", "PropUD", "FinalUD", "EvalSimple", "FindVicinity"];
MyBreak:
PUBLIC
IO.BreakProc =
{
RETURN [
SELECT char
FROM
IN ['a..'z], IN ['A .. 'Z], IN ['0 .. '9] => other,
IO.SP, IO.CR, IO.TAB, IO.LF, IO.FF => sepr,
ENDCASE => break]};
ErrCheck:
PUBLIC
PROC [args:
OPP.ArgList]
RETURNS [errFound:
BOOLEAN] =
BEGIN
WHILE args #
NIL
DO
IF args.first.arg = error THEN RETURN [TRUE];
args ← args.rest;
ENDLOOP;
errFound ← FALSE;
END;
OpsCheck:
PUBLIC
PROC [context:
REF
ANY, sr: SourceRange, ops: OpPrecParse.TokenList, classes: TokenClassList]
RETURNS [err:
BOOL] =
BEGIN
err ← FALSE;
WHILE (ops #
NIL)
AND (classes #
NIL)
AND
NOT err
DO
IF ops.first.class # classes.first THEN {err ← TRUE; EXIT};
ops ← ops.rest;
classes ← classes.rest;
ENDLOOP;
IF (ops # NIL) # (classes # NIL) THEN err ← TRUE;
IF (ops =
NIL)
AND (classes #
NIL)
THEN {
Whimper[sr, context,
SELECT classes.first
FROM
returnClass => "missing RETURN",
rsClass => "missing right square-bracket",
cellEndClass => "missing EndCellType",
ENDCASE => "mismatched LAMBDA - RETURN, [ - ], or CellType - EndCellType"];
RETURN};
IF err THEN Whimper[sr, context, "mismatched LAMBDA - RETURN, [ - ], or CellType - EndCellType"];
END;
ReduceNoisily:
PUBLIC
OPP.Reducer =
BEGIN
reduced ← Complain[sr, context, "Missing op before %g", IO.refAny[args.rest.first.arg]];
END;
SimplerReduce: PUBLIC OPP.Reducer = {reduced ← args.first.arg};
ReduceError: PUBLIC OPP.Reducer = {reduced ← error};
ReduceIntElt:
PUBLIC
OPP.Reducer =
BEGIN
ie: InterfaceElt ← NEW [InterfaceEltRep ← []];
nodeType: REF ANY;
IF ErrCheck[args] THEN RETURN [error];
SELECT ops.first.class
FROM
ltClass => ie.input ← NOT (ie.output ← FALSE);
gtClass => ie.input ← NOT (ie.output ← TRUE);
eqClass => ie.input ← ie.output ← TRUE;
ENDCASE => ERROR;
WITH args.first.arg
SELECT
FROM
id: ID => ie.name ← id.rope;
ENDCASE => RETURN [Complain[sr, context, "An Interface Element must be identified by an ID, not %g", IO.refAny[args.first.arg]]];
IF (nodeType ← args.rest.first.arg) = omitted
THEN {
IF SignalTypeRegistration.defaultNodeType = NIL THEN RETURN [Complain[sr, context, "No default NodeType"]];
nodeType ← NEW [IDRep ← [sr, SignalTypeRegistration.defaultNodeType]]};
WITH nodeType
SELECT
FROM
sti: SignalTypeInvocation => ie.sti ← sti;
id: ID => IF (ie.sti ← InstantiateSignalType[context, id.rope, NIL]) = NIL THEN RETURN [error];
ENDCASE => RETURN [Complain[sr, context, "An Interface Element must use a Signal Type, not %g", IO.refAny[nodeType]]];
ie.sr ← sr;
reduced ← ie;
END;
ReduceLambda:
PUBLIC
OPP.Reducer =
BEGIN
cf: CellFn ← NEW [CellFnRep ← []];
ok: BOOL ← TRUE;
IF ErrCheck[args] THEN RETURN [error];
IF OpsCheck[context, sr, ops, LIST[lambdaClass, returnClass]] THEN RETURN [error];
WITH args.first.arg
SELECT
FROM
sb: SquareBracketed =>
WITH sb.subject
SELECT
FROM
bl: BindingList => cf.args ← bl;
ENDCASE => ok ← FALSE;
ENDCASE => ok ← FALSE;
IF NOT ok THEN RETURN [Complain[sr, context, "LAMBDA must be given parameters, not %g", IO.refAny[args.first.arg]]];
WITH args.rest.first.arg
SELECT
FROM
cd: CellDef => cf.cd ← cd;
ENDCASE => ok ← FALSE;
IF NOT ok THEN RETURN [Complain[sr, context, "I can only construct functions that return cell types, not %g", IO.refAny[args.rest.first.arg]]];
cf.cd.forFn ← cf;
cf.sr ← sr;
reduced ← cf;
END;
ReduceAppl:
PUBLIC
OPP.Reducer =
BEGIN --making either signal type invocation or cell instance
subject: REF ANY;
subjectIsID: BOOL ← FALSE;
subjectAsID: ID;
asAny: REF ANY;
job: Job ← NARROW[context];
parms: REF ANY;
IF ErrCheck[args] THEN RETURN [error];
subject ← args.first.arg;
WITH subject
SELECT
FROM
id: ID => subjectIsID ← TRUE;
a: Application => NULL;
ENDCASE => RETURN [Complain[sr, context, "Must Apply %g to an Application or a simple ID, not %g", IO.refAny[args.rest.first.arg], IO.refAny[args.first.arg]]];
IF args.rest.first.arg = omitted THEN parms ← NEW [ArgsRep ← [sr, NIL]]
ELSE
WITH args.rest.first.arg
SELECT
FROM
ri: Int => parms ← NEW [ArgsRep ← [sr, LIST[ri]]];
rr: Reel => parms ← NEW [ArgsRep ← [sr, LIST[rr]]];
q: Quoted => parms ← NEW [ArgsRep ← [sr, LIST[q]]];
id: ID => parms ← NEW [ArgsRep ← [sr, LIST[id]]];
a: Args => parms ← a;
b: Binding => {bl: BindingList ← LIST[b]; parms ← bl};
bl: BindingList => parms ← bl;
ENDCASE => RETURN [Complain[sr, context, "Must apply to %g a BindingList or ArgList, not %g", IO.refAny[subject], IO.refAny[args.rest.first.arg]]];
IF subjectIsID
THEN {
subjectAsID ← NARROW[subject];
asAny ← SignalTypeRegistration.signalTypes.Lookup[subjectAsID.rope];
IF asAny # NIL THEN RETURN [InstantiateSignalType[context, subjectAsID.rope, parms]];
};
reduced ← NEW [ApplicationRep ← [sr, subject, parms]];
END;
Sofar:
PUBLIC
PROC [sr: SourceRange, context, org:
REF
ANY]
RETURNS [cd: CellDef] =
BEGIN
IF org = autoName THEN cd ← NEW [CellDefRep ← [sr: sr, nameIsLiteral: FALSE, nameSource: NIL]]
ELSE
WITH org
SELECT
FROM
q: Quoted => {
cd ← NEW [CellDefRep ← [sr: sr, literalName: q.rope, nameIsLiteral: TRUE]];
};
cellDef: CellDef => {cd ← cellDef; cd.sr ← sr};
ENDCASE => {
[] ← Complain[sr, context, "Bad Cell header: %g", IO.refAny[org]];
cd ← NIL;
};
END;
InsistOnCedarSource:
PUBLIC
PROC [context:
REF
ANY, sofar:
REF
ANY, args:
OPP.ArgList]
RETURNS [cs: CedarSource, reduced:
REF
ANY] =
BEGIN
WITH args.rest.first.arg
SELECT
FROM
cedar: CedarSource => {cs ← cedar; reduced ← sofar};
ENDCASE => {cs ← NIL; reduced ← Complain[nullSR, context, "Internal Error"]};
END;
ReduceName:
PUBLIC
OPP.Reducer =
BEGIN
IF ErrCheck[args] THEN RETURN [error];
WITH args.first.arg
SELECT
FROM
cs: CedarSource => reduced ← NEW [CellDefRep ← [sr: sr, nameIsLiteral: FALSE, nameSource: cs ]];
ENDCASE => RETURN [Complain[sr, context, "Internal Error"]];
END;
ReduceCell:
PUBLIC
OPP.Reducer =
BEGIN
sofar: CellDef;
IF ErrCheck[args] THEN RETURN [error];
IF OpsCheck[context, sr, ops, LIST[cellClass, cellEndClass]] THEN RETURN [error];
IF (reduced ← sofar ← Sofar[sr, context, args.first.arg]) = NIL THEN RETURN [error];
IF sofar.interfaceLiteral = NIL AND sofar.interfaceSource = NIL THEN sofar.interfaceLiteral ← DigestInterface[context, NIL];
END;
ReducePortsProc:
PUBLIC
OPP.Reducer =
BEGIN
sofar: CellDef;
IF ErrCheck[args] THEN RETURN [error];
IF (sofar ← Sofar[sr, context, args.first.arg]) = NIL THEN RETURN [error];
IF sofar.interfaceSource # NIL THEN Whimper[sr, context, "Redefining PortsProc"];
[sofar.interfaceSource, reduced] ← InsistOnCedarSource[context, sofar, args];
END;
ReduceApply:
PUBLIC
OPP.Reducer =
BEGIN
cf: CellFn;
IF ErrCheck[args] THEN RETURN [error];
WITH args.first.arg
SELECT
FROM
cellFn: CellFn => cf ← cellFn;
ENDCASE => RETURN [Complain[sr, context, "HowToApply tacked onto %g, should have been a Cell Type Function", IO.refAny[args.first.arg]]];
IF cf.howToApply # NIL THEN Whimper[sr, context, "Redefining how to Apply"];
cf.sr ← sr;
[cf.howToApply, reduced] ← InsistOnCedarSource[context, cf, args];
END;
ReduceState:
PUBLIC
OPP.Reducer =
BEGIN
sofar: CellDef;
IF ErrCheck[args] THEN RETURN [error];
IF (sofar ← Sofar[sr, context, args.first.arg]) = NIL THEN RETURN [error];
IF sofar.stateGiven THEN Whimper[sr, context, "Redefining State Vector"];
sofar.stateGiven ← TRUE;
[sofar.stateSource, reduced] ← InsistOnCedarSource[context, sofar, args];
sofar.stateInittable ← FALSE;
END;
ReduceInitState:
PUBLIC
OPP.Reducer =
BEGIN
sofar: CellDef;
IF ErrCheck[args] THEN RETURN [error];
IF (sofar ← Sofar[sr, context, args.first.arg]) = NIL THEN RETURN [error];
IF sofar.stateGiven THEN Whimper[sr, context, "Redefining State Vector"];
sofar.stateGiven ← TRUE;
[sofar.stateSource, reduced] ← InsistOnCedarSource[context, sofar, args];
sofar.stateInittable ← TRUE;
END;
ReducePorts:
PUBLIC
OPP.Reducer =
BEGIN
sofar: CellDef;
IF ErrCheck[args] THEN RETURN [error];
IF (sofar ← Sofar[sr, context, args.first.arg]) = NIL THEN RETURN [error];
WITH args.rest.first.arg
SELECT
FROM
sb: SquareBracketed => {
IF NOT ISTYPE[sb.subject, InterfaceEltList] THEN RETURN [Complain[sr, context, "PORTS must be given a square bracketed interface element list, not %g", IO.refAny[args.rest.first.arg]]];
sofar.interfaceLiteral ← DigestInterface[context, NARROW[sb.subject]]
}
ENDCASE => reduced ← Complain[sr, context, "PORTS must be given a square bracketed interface element list, not %g", IO.refAny[args.rest.first.arg]];
reduced ← sofar;
END;
ReduceExpand:
PUBLIC
OPP.Reducer =
BEGIN
sofar: CellDef;
IF ErrCheck[args] THEN RETURN [error];
IF (sofar ← Sofar[sr, context, args.first.arg]) = NIL THEN RETURN [error];
IF sofar.expandGiven THEN Whimper[sr, context, "Redefining Expand Proc"];
sofar.expandGiven ← TRUE;
reduced ← sofar;
WITH args.rest.first.arg
SELECT
FROM
s: Statements => sofar.expandCode ← s;
cs: CedarSource => sofar.expandCode ← NEW [StatementsRep ← [sr, LIST[cs]]];
bl: BindingList => sofar.expandCode ← NEW [StatementsRep ← [sr, LIST[bl]]];
b: Binding => sofar.expandCode ← NEW [StatementsRep ← [sr, LIST[b]]];
ENDCASE => reduced ← Complain[sr, context, "EXPAND must be given a statement or statement list, not %g", IO.refAny[args.rest.first.arg]];
END;
ReduceIOCreator:
PUBLIC
OPP.Reducer =
BEGIN
sofar: CellDef;
IF ErrCheck[args] THEN RETURN [error];
IF (sofar ← Sofar[sr, context, args.first.arg]) = NIL THEN RETURN [error];
IF sofar.ioCreatorGiven THEN Whimper[sr, context, "Redefining IOCreator"];
sofar.ioCreatorGiven ← TRUE;
[sofar.ioCreatorSource, reduced] ← InsistOnCedarSource[context, sofar, args];
END;
ReduceIORefType:
PUBLIC
OPP.Reducer =
BEGIN
sofar: CellDef;
IF ErrCheck[args] THEN RETURN [error];
IF (reduced ← sofar ← Sofar[sr, context, args.first.arg]) = NIL THEN RETURN [error];
IF sofar.ioRefTypeName # NIL THEN Whimper[sr, context, "Redefining IORef TYPE name"];
WITH args.rest.first.arg
SELECT
FROM
id: ID => sofar.ioRefTypeName ← id.rope;
ENDCASE => reduced ← Complain[sr, context, "An IORef TYPE name must be an ID, not %g", IO.refAny[args.rest.first.arg]];
END;
ReduceInitializer:
PUBLIC
OPP.Reducer =
BEGIN
sofar: CellDef;
IF ErrCheck[args] THEN RETURN [error];
IF (sofar ← Sofar[sr, context, args.first.arg]) = NIL THEN RETURN [error];
IF sofar.initializerGiven THEN Whimper[sr, context, "Redefining Initializer"];
sofar.initializerGiven ← TRUE;
[sofar.initializerSource, reduced] ← InsistOnCedarSource[context, sofar, args];
END;
ReduceEval:
PUBLIC
OPP.Reducer =
BEGIN
sofar: CellDef;
type: EvalType ← ToEvalType[ops.first.class];
IF ErrCheck[args] THEN RETURN [error];
IF (sofar ← Sofar[sr, context, args.first.arg]) = NIL THEN RETURN [error];
IF sofar.evalsGiven[type] THEN Whimper[sr, context, "Redefining %g Proc", IO.rope[evalKeywords[type]]];
sofar.evalsGiven[type] ← TRUE;
[sofar.evalSources[type], reduced] ← InsistOnCedarSource[context, sofar, args];
END;
ToEvalType:
PROC [class: TokenClass]
RETURNS [et: EvalType] =
BEGIN
FOR et IN EvalType DO IF evalClasses[et] = class THEN RETURN ENDLOOP;
ERROR;
END;
ReduceBBTest:
PUBLIC
OPP.Reducer =
BEGIN
sofar: CellDef;
IF ErrCheck[args] THEN RETURN [error];
IF (sofar ← Sofar[sr, context, args.first.arg]) = NIL THEN RETURN [error];
IF sofar.bbTestGiven THEN Whimper[sr, context, "Redefining Black Box Test Proc"];
sofar.bbTestGiven ← TRUE;
[sofar.bbTestSource, reduced] ← InsistOnCedarSource[context, sofar, args];
END;
ReduceSTTest:
PUBLIC
OPP.Reducer =
BEGIN
sofar: CellDef;
IF ErrCheck[args] THEN RETURN [error];
IF (sofar ← Sofar[sr, context, args.first.arg]) = NIL THEN RETURN [error];
IF sofar.stTestGiven THEN Whimper[sr, context, "Redefining Test (State Too) Proc"];
sofar.stTestGiven ← TRUE;
[sofar.stTestSource, reduced] ← InsistOnCedarSource[context, sofar, args];
END;
ReduceInitCTProps:
PUBLIC
OPP.Reducer =
BEGIN
sofar: CellDef;
IF ErrCheck[args] THEN RETURN [error];
IF (sofar ← Sofar[sr, context, args.first.arg]) = NIL THEN RETURN [error];
IF sofar.initCTPropsGiven THEN Whimper[args.rest.first.sr, context, "Redefining Initial Props Proc"];
sofar.initCTPropsGiven ← TRUE;
[sofar.initCTPropsSource, reduced] ← InsistOnCedarSource[context, sofar, args];
END;
CompareOps:
PUBLIC
OSTR.CompareProc =
BEGIN
s1, s2: ROPE;
s1 ←
WITH r1
SELECT
FROM
r: ROPE => r,
op: Op => op.name,
ENDCASE => ERROR;
s2 ←
WITH r2
SELECT
FROM
r: ROPE => r,
op: Op => op.name,
ENDCASE => ERROR;
RETURN [s1.Compare[s2, FALSE]];
END;
ParseExpression:
PUBLIC
PROC [job: Job]
RETURNS [expr:
REF
ANY] =
BEGIN
GetToken:
OPP.TokenProc =
BEGIN
asRope: ROPE;
op: Op;
peek: CHAR;
startIdx: INT;
GetSR:
PROC
RETURNS [sr: SourceRange] = {
next: INT ← job.from.GetIndex[];
sr ← [startIdx, next-1]};
HandleNumber:
PROC [sgn:
INT]
RETURNS [
OPP.Token] =
BEGIN
tokenKind: IO.TokenKind;
token: ROPE;
[tokenKind, token, ] ← job.from.GetCedarTokenRope[];
SELECT tokenKind
FROM
tokenREAL => RETURN [[GetSR[], myArgClass, NEW [ReelRep ← [GetSR[], Convert.RealFromLiteral[token]*sgn]]]];
tokenDECIMAL, tokenOCTAL, tokenHEX =>
RETURN [[
GetSR[],
myArgClass,
NEW [IntRep ← [
GetSR[],
sgn*Convert.CardFromWholeNumberLiteral[token]]]]];
ENDCASE => ERROR;
END;
WHILE
TRUE
DO
ProcessExtras.CheckForAbort[];
IF useOld THEN {useOld ← FALSE; RETURN [[oldSR, myArgClass, old]]};
[] ← job.from.SkipWhitespace[flushComments: FALSE];
startIdx ← job.from.GetIndex[];
IF job.from.EndOf[] THEN RETURN [OPP.end];
job.tokenCount ← job.tokenCount + 1;
peek ← job.from.PeekChar[];
IF peek = '"
THEN
BEGIN
asAny: REF ANY ← IO.GetRefAny[job.from];
asRope: ROPE ← NARROW[asAny];
RETURN [[GetSR[], myArgClass, NEW [QuotedRep ← [GetSR[], asRope]] ]];
END;
IF peek = '|
THEN
BEGIN
cedar: ROPE ← NIL;
IF job.from.GetChar[] # '| THEN ERROR;
WHILE
NOT job.from.EndOf[]
DO
char: CHAR ← job.from.GetChar[];
IF char = '|
THEN
BEGIN
IF job.from.PeekChar[] # '| THEN EXIT ELSE [] ← job.from.GetChar[];
END;
cedar ← cedar.Concat[Rope.FromChar[char]];
ENDLOOP;
RETURN [[GetSR[], myArgClass, NEW [CedarLiteralRep ← [GetSR[], cedar]] ]];
END;
IF peek = '(
THEN
BEGIN
asAny: REF ANY;
asAny ←
IO.GetRefAny[job.from !
IO.Error,
IO.EndOfStream => {
Whimper[GetSR[], job, "Syntax error in list"];
asAny ← error;
CONTINUE}];
IF asAny = error THEN RETURN [IF expectingArg THEN arglikeError ELSE oplikeError];
RETURN [[GetSR[], myArgClass, NEW [RefAnyListRep ← [GetSR[], NARROW[asAny]]] ]];
END;
IF peek IN ['0 .. '9] THEN RETURN [HandleNumber[1]];
IF peek = '-
THEN
BEGIN
IF job.from.GetChar[] # '- THEN ERROR;
IF (peek ← job.from.PeekChar[]) = '-
THEN
BEGIN
IF job.from.GetChar[] # '- THEN ERROR;
WHILE
NOT job.from.EndOf[]
DO
char: CHAR ← job.from.GetChar[];
IF char = '\n THEN EXIT;
IF char = '-
THEN
BEGIN
char ← job.from.GetChar[];
IF char = '- OR char = '\n THEN EXIT;
END;
ENDLOOP;
LOOP;
END
ELSE IF peek IN ['0 .. '9] THEN RETURN [HandleNumber[-1]]
ELSE asRope ← "-";
END
ELSE asRope ← job.from.GetTokenRope[MyBreak].token;
op ← NARROW[ops.Lookup[asRope]];
IF op = NIL THEN RETURN [[GetSR[], myArgClass, NEW [IDRep ← [GetSR[], asRope]] ]];
IF op.eatsCedar
THEN
BEGIN
char: CHAR ← job.from.GetChar[]; --counter Backup in GetToken
parent: TextNode.Ref ← TS.CurInNode[job.from];
to allow comments there, don't test: IF char # '\n THEN ERROR;
TS.SkipChildren[job.from];
useOld ← TRUE;
oldSR ← GetSR[];
old ← NEW [CedarSourceRep ← [GetSR[], parent]];
END;
IF op.class[expectingArg] =
NIL
THEN
BEGIN
job.log.PutF["Syntax error at %g: %g not allowed\n", IO.int[job.from.GetIndex[]], IO.rope[asRope]];
job.errCount ← job.errCount + 1;
RETURN [IF expectingArg THEN arglikeError ELSE oplikeError];
END;
RETURN [[GetSR[], op.class[expectingArg], op]];
ENDLOOP;
END;
useOld: BOOLEAN ← FALSE;
oldSR: SourceRange;
old: REF ANY ← NIL;
[] ← job.from.GetIndex[];
[[, expr]] ←
OPP.Parse[job, GetToken !
OPP.CantReduce,
OPP.CantFix,
OPP.DoesntFix,
OPP.TerminateErr,
OPP.LastReduceErr,
OPP.InvalidToken =>
BEGIN
job.log.PutF["Congratulations! You trashed the parser (somewhere before %g)... You lose!\n", IO.int[job.from.GetIndex[]]];
job.errCount ← job.errCount + 1;
expr ← NIL;
CONTINUE;
END];
END;
Setup:
PROC =
BEGIN
noisyErrClass ← NEW[TokenClassRep ← [2000, 3000, ReduceNoisily]];
myArgClass ← NEW[TokenClassRep ← [0, 0, NIL, [nullSR, noisyErrClass, NIL]]];
ltClass ← NEW[TokenClassRep ← [510, 500, ReduceIntElt]];
gtClass ← NEW[TokenClassRep ← [510, 500, ReduceIntElt]];
eqClass ← NEW[TokenClassRep ← [510, 500, ReduceIntElt]];
colonClass ← NEW[TokenClassRep ← [410, 400, ReduceBinding]];
arrowClass ← NEW[TokenClassRep ← [350, 360, ReduceArrow]];
dashClass ← NEW[TokenClassRep ← [350, 360, ReduceDash]];
assertClass ← NEW[TokenClassRep ← [80, 90, ReduceAssert]];
commaClass ← NEW[TokenClassRep ← [310, 300, ReduceComma, [nullSR, OPP.argClass, omitted]]];
cedarClass ← NEW[TokenClassRep ← [0, 10000, SimplerReduce]];
nameClass ← NEW[TokenClassRep ← [0, 10000, ReduceName]];
directoryClass ← NEW[TokenClassRep ← [0, 275, ReduceDirectory]];
importsClass ← NEW[TokenClassRep ← [0, 275, ReduceImports]];
openClass ← NEW[TokenClassRep ← [0, 275, ReduceOpen]];
libClass ← NEW[TokenClassRep ← [0, 275, ReduceLibrary]];
errorClass ← NEW[TokenClassRep ← [250, 250, ReduceError]];
lambdaClass ← NEW[TokenClassRep ← [0, 150, ReduceLambda]];
returnClass ← NEW[TokenClassRep ← [150, 1000, NIL]];
squareClass ← NEW[TokenClassRep ← [0, 200, ReduceSquare]];
applClass ← NEW[TokenClassRep ← [1000, 200, ReduceAppl]];
rsClass ← NEW[TokenClassRep ← [200, 0, NIL, [nullSR, OPP.argClass, omitted]]];
semiClass ← NEW[TokenClassRep ← [110, 100, ReduceSemi]];
portsProcClass← NEW[TokenClassRep ← [80, 90, ReducePortsProc]];
applyClass ← NEW[TokenClassRep ← [810, 90, ReduceApply]];
stateClass ← NEW[TokenClassRep ← [80, 90, ReduceState]];
initStateClass ← NEW[TokenClassRep ← [80, 90, ReduceInitState]];
ioCreatorClass ← NEW[TokenClassRep ← [80, 90, ReduceIOCreator]];
ioRefTypeClass ← NEW[TokenClassRep ← [80, 90, ReduceIORefType]];
initializerClass ← NEW[TokenClassRep ← [80, 90, ReduceInitializer]];
bbTestClass ← NEW[TokenClassRep ← [80, 90, ReduceBBTest]];
stTestClass ← NEW[TokenClassRep ← [80, 90, ReduceSTTest]];
initCTPropsClass← NEW[TokenClassRep← [80, 90, ReduceInitCTProps]];
expandClass ← NEW[TokenClassRep ← [80, 90, ReduceExpand]];
portsClass← NEW[TokenClassRep ← [80, 90, ReducePorts]];
cellClass ← NEW[TokenClassRep ← [0, 10, ReduceCell]];
cellEndClass← NEW[TokenClassRep ← [10, 0]];
FOR et: EvalType
IN EvalType
DO
evalClasses[et] ← NEW[TokenClassRep ← [80, 90, ReduceEval]];
ops.Insert[NEW[OpRep ← [evalKeywords[et], [evalClasses[et], NIL], TRUE]]];
ENDLOOP;
ops.Insert[NEW[OpRep ← [":", [colonClass, NIL]]]];
ops.Insert[NEW[OpRep ← ["←", [arrowClass, NIL]]]];
ops.Insert[NEW[OpRep ← ["-", [dashClass, NIL]]]];
ops.Insert[NEW[OpRep ← ["<", [ltClass, NIL]]]];
ops.Insert[NEW[OpRep ← [">", [gtClass, NIL]]]];
ops.Insert[NEW[OpRep ← ["=", [eqClass, NIL]]]];
ops.Insert[NEW[OpRep ← [",", [commaClass, commaClass]]]];
ops.Insert[NEW[OpRep ← ["LAMBDA", [NIL, lambdaClass]]]];
ops.Insert[NEW[OpRep ← ["RETURN", [returnClass, NIL]]]];
ops.Insert[NEW[OpRep ← ["[", [applClass, squareClass]]]];
ops.Insert[NEW[OpRep ← ["]", [rsClass, rsClass]]]];
ops.Insert[NEW[OpRep ← [";", [semiClass, NIL]]]];
ops.Insert[NEW[OpRep ← ["CELLTYPE", [NIL, cellClass]]]];
ops.Insert[NEW[OpRep ← ["EndCellType", [cellEndClass, NIL]]]];
ops.Insert[NEW[OpRep ← ["PORTS", [portsClass, NIL]]]];
ops.Insert[NEW[OpRep ← ["PortsProc", [portsProcClass, NIL], TRUE]]];
ops.Insert[NEW[OpRep ← ["ApplyCode",[applyClass, NIL], TRUE]]];
ops.Insert[NEW[OpRep ← ["Assert", [assertClass, NIL]]]];
ops.Insert[NEW[OpRep ← ["State", [stateClass, NIL], TRUE]]];
ops.Insert[NEW[OpRep ← ["InittableState", [initStateClass, NIL], TRUE]]];
ops.Insert[NEW[OpRep ← ["IOCreator", [ioCreatorClass, NIL], TRUE]]];
ops.Insert[NEW[OpRep ← ["IORefTypeName", [ioRefTypeClass, NIL]]]];
ops.Insert[NEW[OpRep ← ["Initializer", [initializerClass, NIL], TRUE]]];
ops.Insert[NEW[OpRep ← ["Expand", [expandClass, NIL]]]];
ops.Insert[NEW[OpRep ← ["CEDAR", [NIL, cedarClass], TRUE]]];
ops.Insert[NEW[OpRep ← ["NameMaker",[NIL, nameClass], TRUE]]];
ops.Insert[autoName← NEW[OpRep ← ["AutoName",[NIL, myArgClass], FALSE]]];
ops.Insert[NEW[OpRep ← ["BlackBoxTest", [bbTestClass, NIL], TRUE]]];
ops.Insert[NEW[OpRep ← ["TestStateToo", [stTestClass, NIL], TRUE]]];
ops.Insert[NEW[OpRep ← ["InitCTProps", [initCTPropsClass, NIL], TRUE]]];
ops.Insert[NEW[OpRep ← ["Directory", [NIL, directoryClass]]]];
ops.Insert[NEW[OpRep ← ["Imports", [NIL, importsClass]]]];
ops.Insert[NEW[OpRep ← ["Open", [NIL, openClass]]]];
ops.Insert[NEW[OpRep ← ["Library", [NIL, libClass]]]];
arglikeError ← [nullSR, OPP.argClass, error];
oplikeError ← [nullSR, errorClass, NIL];
END;
Setup[];
END.