SaffronPGPrivateTypes.Mesa
Copyright Ó 1988 by Xerox Corporation. All rights reserved.
James Rauen, June 13, 1988 11:25:46 am PDT
Last edited by: James Rauen June 20, 1988 4:40:39 pm PDT
DIRECTORY
Rope USING [ROPE],
SaffronTargetArchitecture USING [TargetIntNode, TargetRealNode, TargetBooleanNode, TargetRopeNode];
SaffronPGPrivateTypes:
CEDAR
DEFINITIONS ~
BEGIN
ProgramGraphNode: TYPE ~ REF ProgramGraphNodeBody;
ProgramGraphNodeBody:
TYPE ~
RECORD [
operation: INT ← 0,
ifNull: REF ProgramGraphNode,
ifTrue: REF ProgramGraphNode,
ifFalse: REF ProgramGraphNode
];
EvaluatedExpressionNode: TYPE ~ REF EvaluatedExpressionNodeBody;
EvaluatedExpressionNodeBody: TYPE ~ RECORD [
eType: SELECT type: * FROM
integer => [value: INT],
real => [value: REAL],
boolean => [value: BOOLEAN],
rope => [value: Rope.ROPE],
computed => [code: ProgramGraphNode],
ENDCASE
];
RuntimeValueType: TYPE ~ {int, real, boolean, rope, error, other};
RuntimeValueNode: TYPE ~ REF RuntimeValueNodeBody;
RuntimeValueNodeBody: TYPE ~ RECORD [
type: RuntimeValueType,
val: SELECT knownAtCompileTime: * FROM
yes => [value: REF ANY],
no => [code: ProgramGraphNode],
undetermined => [foo: BOOLEAN],
ENDCASE
];
MakeCompileTimeConstant: PROC [value: REF ANY] RETURNS [RuntimeValueNode] ~ INLINE BEGIN
RETURN[NEW[RuntimeValueNodeBody ← [
type: WITH value SELECT FROM
foo: SaffronTargetArchitecture.TargetIntNode => int,
foo: SaffronTargetArchitecture.TargetRealNode => real,
foo: SaffronTargetArchitecture.TargetBooleanNode => boolean,
foo: SaffronTargetArchitecture.TargetRopeNode => rope,
ENDCASE => error,
val: yes[value]
]]];
END;
MakeComputedRuntimeValue: PROC [type: RuntimeValueType, code: ProgramGraphNode] RETURNS [RuntimeValueNode] ~ INLINE BEGIN
RETURN[NEW[RuntimeValueNodeBody ← [type: type, val: no[code]]]];
END;
END.