Evaluator.mesa
Copyright © 1985 by Xerox Corporation. All rights reserved.
Arnon, March 4, 1986 12:02:24 pm PST
Evaluator
SimpleBinaryStructureLUB: AlgebraClasses.BinaryStructureLUBOp;
Check for trivial cases; if not, see if canRecast one structure as the other; if so do it, else return NIL (thus if we get GeneralExpressions back, we know that it's really the LUB)
SimplePolyStructureForVar: AlgebraClasses.UnaryOp;
Given variable V, returns the structure Z[V].
BinaryStructureLUB: AlgebraClasses.BinaryStructureLUBOp;
This one has some algebraic smarts. First calls SimpleBinaryStructureLUB, then gets fancy; if fails, returns GeneralExpressions.
Eval:
PROC[expr:
EXPR, sourceStructureForMethod: Object ←
NIL]
RETURNS[Object];
effects: Evaluates the input, looking first for (outermost) method in sourceStructureForMethod if nonNIL.
sourceStructureForMethod must be nonNIL for nullary methods.
KillVariable: AlgebraClasses.UnaryOp;
effects: delete the Environment value associated with var, if present. Only needed when want to delete a variable name entirely, not if just want to replace.
KillAll: AlgebraClasses.TrueNullaryOp;
Do a ResetEnvironment, i.e. kill all variables