CedarBaseContext.Mesa
Copyright Ó 1987 by Xerox Corporation. All rights reserved.
Shoup, August 4, 1986 6:20:47 pm PDT
Bill Jackson (bj) April 16, 1987 1:05:15 am PDT
DIRECTORY
CedarBaseType USING [TypeIndex],
CedarBaseValue USING [Value],
SaffronGenericDef USING [idNode],
IO USING [STREAM];
CedarBaseContext:
CEDAR
DEFINITIONS ~ {
idNode: TYPE ~ SaffronGenericDef.idNode;
TypeIndex: TYPE ~ CedarBaseType.TypeIndex;
Value: TYPE ~ CedarBaseValue.Value;
LocalContext
A LocalContext is a map from idNode to Descriptor.
LocalContext: TYPE ~ REF LocalContextRep;
LocalContextRep: TYPE;
PrintLocalContext: PROC [LocalContext, IO.STREAM] RETURNS [BOOLEAN];
XLocalContext:
PROC [LocalContext]
RETURNS [LocalContext];
The identity fcn ... needed to appease Casaba.
CreateLocalContext: PROC [] RETURNS [LocalContext];
LocalLookup:
PROC [LocalContext, idNode]
RETURNS [Descriptor];
Returns an Undefined Descriptor if idNode is not found.
InsertContext:
PROC [LocalContext, idNode, Descriptor]
RETURNS [LocalContext,
BOOLEAN];
If idNode has not already been entered, it is entered and the BOOLEAN result flag is set to TRUE; otherwise, the LocalContext is unchanged and the flag is set to FALSE.
ReplaceContext:
PROC [LocalContext, idNode, Descriptor]
RETURNS [LocalContext,
BOOLEAN];
If idNode has already been entered, its descriptor is changed and the BOOLEAN result flag is set to TRUE; otherwise, the LocalContext is unchanged and the flag is set to FALSE.
RibContext
A RibContext is a map from idNode to Descriptor, just like a LocalContext. A RibContext is constructed from a sequence of LocalContext's. RibContext's are never damaged.
RibContext: TYPE ~ REF RibContextRep;
RibContextRep: TYPE;
CreateRibContext: PROC [] RETURNS [RibContext];
RibLookup: PROC [RibContext, idNode] RETURNS [Descriptor];
Lookup:
PROC [RibContext, LocalContext, idNode]
RETURNS [Descriptor];
This does a LocalLookup, followed by a RibLookup if necessary.
ExtendRibContext:
PROC [RibContext, LocalContext]
RETURNS [RibContext];
The entries in the LocalContext take precedence over the entries in the input RibContext.
Descriptor
A Descriptor is the denotation of identifiers, i.e. the range of the Context maps.
Descriptor: TYPE ~ REF DescriptorRep;
DescriptorRep: TYPE;
BuildValueDescriptor: PROC [Value] RETURNS [Descriptor];
GetValue: PROC[Descriptor] RETURNS [Value];
IsValueDescriptor:
PROC [Descriptor]
RETURNS [
BOOLEAN];
Represents a value, e.g. the INTEGER 3.
BuildSuspendedDescriptor: PROC [REF] RETURNS [Descriptor];
IsSuspendedDescriptor: PROC [Descriptor] RETURNS [BOOLEAN];
DescriptorGetDecl:
PROC [Descriptor]
RETURNS [
REF];
Represents a named value whose declaration has not yet been examined.
BuildInaccessibleDescriptor: PROC [] RETURNS [Descriptor];
IsInaccessibleDescriptor:
PROC [Descriptor]
RETURNS [
BOOLEAN];
Represents a named value whose declaration is currently being examined. If you bump into one of these, you have detected a circularly defined value.
BuildTypeDescriptor: PROC [TypeIndex] RETURNS [Descriptor];
GetType: PROC [Descriptor] RETURNS [TypeIndex];
IsTypeDescriptor:
PROC [Descriptor]
RETURNS [
BOOLEAN];
Represents a TYPE.
BuildUndefinedDescriptor: PROC [] RETURNS [Descriptor];
IsUndefinedDescriptor:
PROC [Descriptor]
RETURNS [
BOOLEAN];
This is returned by the Context lookup fcns for undeclared names.
ContextTree
ContextTree: TYPE ~ REF ContextTreeRep;
ContextTreeRep: TYPE;
BuildContextTree: PROC [RibContext, ContextTreeList] RETURNS [ContextTree];
ContextTreeList
ContextTreeList: TYPE ~ REF ContextTreeListRep;
ContextTreeListRep: TYPE;
BuildEmptyContextTreeList: PROC [] RETURNS [ContextTreeList];
}...