= BEGIN
Runtime errors.
RTError: ERROR[ec: ATOM ← NIL];
Every value is a pointer to an object.
RTValue: TYPE = REF ANY;
Tuples (objects of dependent product types) are comma-separated sequences of bindings. The empty tuple is represented by NIL.
RTTuple: TYPE = REF ANY;
emptyRTTuple: RTTuple ~ NIL;
ConsRTNode:
TYPE =
RECORD [
leftPart, rightPart: RTTuple
];
BindingRTNode:
TYPE =
RECORD [
name: ATOM,
value: RTValue
];
MkTuple: PROCEDURE [name: ATOM, value: RTValue] RETURNS [RTTuple] ;
ConcatTuple: PROCEDURE [tuple1,tuple2: RTValue] RETURNS [RTTuple] ;
SelectFromTuple: PROCEDURE [tuple: RTValue, name: ATOM] RETURNS [RTValue] ;
QueryTuple: PROCEDURE [tuple: RTValue, name: ATOM] RETURNS [BOOL] ;
Closures (objects of procedure or function types)
RTCodeBody: TYPE = PROCEDURE[ env: RTTuple, arg: RTValue, ip: REF ANY ] RETURNS[RTValue];
RTClosure: TYPE = REF ClosureRTNode;
ClosureRTNode:
TYPE =
RECORD [
ep: RTTuple,
ip: REF ANY,
cb: RTCodeBody
];
MkClosure: PROCEDURE [ep: RTValue, ip: REF ANY, cb: RTCodeBody] RETURNS [RTClosure] ;
ApplyClosure: PROCEDURE [closure: RTValue, arg: RTValue ] RETURNS [RTValue] ;
Procedures for manipulating environments.
PrependValue: PROCEDURE [tuple: RTTuple, name: ATOM, value: RTValue] RETURNS[RTTuple] ;
PrependProc: PROCEDURE [tuple: RTTuple, name: ATOM, body: RTCodeBody] RETURNS[RTTuple] ;
Locations and the store
RTLocation: TYPE = REF RTValue;
ValueOf: PROCEDURE [location: RTValue] RETURNS [RTValue] ;
Assign: PROCEDURE [location: RTValue, value: RTValue] RETURNS [RTValue] ;
New: PROCEDURE [] RETURNS [RTLocation] ;
END .