CoreContext.mesa
Copyright © 1985 by Xerox Corporation. All rights reserved.
Created by Pradeep Sindhu, December 12, 1985 10:04:33 pm PST
Pradeep Sindhu December 13, 1985 2:01:42 am PST
Louis Monier December 13, 1985 3:04:07 pm PST
DIRECTORY
AMModel USING [Context],
Rope USING [ROPE],
SymTab USING [Ref];
CoreContext: CEDAR DEFINITIONS = BEGIN
Abstract
This module provides the interface for a Core Context—a (possibly empty) set of named variables along with their values. Variable are named by ROPEs and can have any Cedar type. The basic procedures allow creation of an empty context, copying of an existing context to a new one, and storing a value into an existing or a new variable. There is also a procedure to evaluate an arbitrary Cedar expression in the given context.
Types
Context: TYPE = SymTab.Ref;
ROPE: TYPE = Rope.ROPE;
Context Handling Procedures
Create: PUBLIC PROC [] RETURNS [cx: Context];
Copy: PUBLIC PROC [cx: Context] RETURNS [newCx: Context];
Creates a new context and copies cx to it.
Store: PUBLIC PROC [cx: Context, var: ROPE, value: REFNIL];
Stores value into var in cx; if var didn't exist it is created; a NIL value removes var from cx.
Eval: PUBLIC PROC [cx: Context, expr: ROPE, cedarCx: AMModel.Context ← NIL] RETURNS [REF];
Computes the value of expr in <cx, cedarCx>; a NIL returned means expr had no value.
END.