SiroccoPrivateTypes.Mesa
Copyright Ó 1987 by Xerox Corporation. All rights reserved.
Bill Jackson (bj) August 26, 1987 4:08:47 pm PDT
DIRECTORY
IO USING [ STREAM ],
SiroccoCGDef USING [ BaseTypeKind ],
SiroccoPrivate USING [ AbstractValue, CONTEXT, TypeGraphNode ],
Rope USING [ ROPE ];
SiroccoPrivateTypes: CEDAR DEFINITIONS ~ {
OPEN SiroccoCGDef, SiroccoPrivate;
ROPE: TYPE ~ Rope.ROPE;
Open stuff...
ContextTreeNode: TYPE ~ REF;
AVNDumpProc: TYPE ~ PROC [ s: IO.STREAM, value: AbstractValue, n: NAT ← 1 ];
TGNDumpProc: TYPE ~ PROC [ s: IO.STREAM, node: TypeGraphNode, n: NAT ← 1 ];
AVNWalkProc: TYPE ~ PROC [ s: IO.STREAM, value: AbstractValue, context: CONTEXT];
TGNWalkProc: TYPE ~ PROC [ s: IO.STREAM, node: TypeGraphNode, context: CONTEXT ];
TypeGraphNode
TGNKind2: TYPE ~ {
bool, card16, card32, int16, int32, sink, source, string, unspec,
array, choice, enum, error, proc, record, seq,
logical, constructor, grouping, negation, null, number, rope, variant
};
This is really the union of BaseTypeKind, ConstructorKind & AbstractValueKind
TypeConstructorKind: TYPE ~ { array, choice, enum, error, proc, record, seq };
AbstractValueKind: TYPE ~ { constructor, grouping, logical, negation, null, number, rope, variant };
Program
Program.export [ id.export, decimal.pgm, decimal.version, ImportList, DeclarationList ];
Environment
EnvironmentNode: TYPE ~ REF EnvironmentNodeBody;
EnvironmentNodeBody: TYPE ~ RECORD [
interfaces: REF
];
Interfaces
Interfaces are not InterfaceTGNs. InterfaceTGNs occur inside type graphs, and point out to other contexts. Interfaces occur outside type graphs (and contexts) and point into contexts.
NOTE: We almost had to use proto and frozen interfaces, because we wanted to be able to have more than one module name for an interface. If this were implemented by adding the names one at a time to the interface, this would make the interface a modifiable data structure, which must then be frozen when placed in an environment. However, by using NameSequences (see below), which are built non-destructively, and building the interface directly from a NameSequence and a contextTree, we avoid having malleable interfaces.
ImportList.empty [] ;
ImportList.more [ ImportList, Import ];
Import.interface [ id.interface, decimal.pgm, decimal.version ];
InterfaceValNode: TYPE ~ REF InterfaceValNodeBody;
InterfaceValNodeBody: TYPE ~ RECORD [
moduleNames: NameSequenceNode,
entries: VisibleNames,
ct: ContextTreeNode
];
Locally Visible Names
DeclarationList.empty [ ];
DeclarationList.more [ DeclarationList, Declaration ];
Declaration.type [ id, Type ];
Declaration.constant [ id, Type, Constant ];
Very simple for now, just a chained list of ROPEs
VisibleNames: TYPE ~ REF VisibleNamesBody;
VisibleNamesBody: TYPE ~ RECORD [
head: LIST OF VNCell
];
VNCell: TYPE ~ REF VNCellBody;
VNCellBody: TYPE ~ RECORD [
id: ROPE,
value: REF ANY
];
Hack TGN
Enumeration.more [ Enumeration.value, Enumeration.next ];
FieldList.more [ FieldList.value, FieldList.rest ];
Union.more [ Union.value, Union.next ];
HackTGN: TYPE ~ REF HackTGNBody;
HackTGNBody: TYPE ~ RECORD [
value: TypeGraphNode,
next: TypeGraphNode
];
assorted body types
Array TGN
Type.array [ Constant, Type ];
ArrayTGN: TYPE ~ REF ArrayTGNBody;
ArrayTGNBody: TYPE ~ RECORD [
length: AbstractValue,
itemType: TypeGraphNode
];
BaseType TGN
Type.bool [ ];
Type.card16 [ ];
Type.card32 [ ];
Type.int16 [ ];
Type.int32 [ ];
Type.sink [ ];
Type.source [ ];
Type.string [ ];
Type.unspec [ ];
BaseTypeTGN: TYPE ~ REF BaseTypeTGNBody;
BaseTypeTGNBody: TYPE ~ RECORD [
type: BaseTypeKind
];
Choice TGN
Type.choice [ Type, Union ];
ChoiceTGN: TYPE ~ REF ChoiceTGNBody;
ChoiceTGNBody: TYPE ~ RECORD [
ktype: TypeGraphNode,
union: TypeGraphNode
];
Deref TGN
Type.alias [ id ];
DerefTGN: TYPE ~ REF DerefTGNBody;
DerefTGNBody: TYPE ~ RECORD [
item: ROPE,
type: TypeGraphNode
];
EnumeratedType Nodes
Type.enum [ Enumeration ];
Enumeration.one [ id, Constant ];
EnumTGN: TYPE ~ REF EnumTGNBody;
EnumTGNBody: TYPE ~ RECORD [
enum: TypeGraphNode
];
Error TGN
Type.error [ FieldList ];
ErrorTGN: TYPE ~ REF ErrorTGNBody;
ErrorTGNBody: TYPE ~ RECORD [
fieldlist: TypeGraphNode
];
Field lists and frozen field lists
FieldList.empty [ ];
FieldList.one [ NameList, Type ];
FieldTGN: TYPE ~ REF FieldTGNBody;
FieldTGNBody: TYPE ~ RECORD [
namelist: TypeGraphNode,
type: TypeGraphNode
];
FieldListTGN: TYPE ~ REF FieldListTGNBody;
FieldListTGNBody: TYPE ~ RECORD [
tag: ROPE,
ordinal: AbstractValue
];
Interface TGN
InterfaceTGN: TYPE ~ REF InterfaceTGNBody;
InterfaceTGNBody: TYPE ~ RECORD [
typeNames: VisibleNames
];
LinkTGN
Type.import [ id.interface, id.item ];
used to interface between one module and another
LinkTGN: TYPE = REF LinkTGNBody;
LinkTGNBody: TYPE = RECORD [
tgn: TypeGraphNode, -- in target module
interface: ROPE, -- InterfaceValNode of target module
item: ROPE -- name of item in interface
];
NameSequence
NameList.empty [ ];
NameList.one [ id ];
NameList.more [ id, NameList ];
NameSequenceNode: TYPE ~ REF NameSequenceNodeBody;
NameSequenceNodeBody: TYPE ~ RECORD [
head: LIST OF ROPE
];
Proc TGN
Type.proc [ FieldList.arg, FieldList.res, NameList ];
ProcTGN: TYPE ~ REF ProcTGNBody;
ProcTGNBody: TYPE ~ RECORD [
args: TypeGraphNode,
results: TypeGraphNode,
errors: TypeGraphNode
];
Record TGN
Type.record [ FieldList ];
Type.null [ ];
RecordTGN: TYPE ~ REF RecordTGNBody;
RecordTGNBody: TYPE ~ RECORD [
fieldlist: TypeGraphNode
];
Sequence TGN
Type.seq [ Constant, Type ];
SequenceTGN: TYPE ~ REF SequenceTGNBody;
SequenceTGNBody: TYPE ~ RECORD [
maxlength: AbstractValue,
subtype: TypeGraphNode
];
Union TGN
Union.one [ NameList, Type ];
UnionTGN: TYPE ~ REF UnionTGNBody;
UnionTGNBody: TYPE ~ RECORD [
namelist: TypeGraphNode,
type: TypeGraphNode
];
Hack AVN
Grouping.more [ Constant, Grouping ];
Constructor.more [ Binding, Constructor ];
HackAVN: TYPE ~ REF HackAVNBody;
HackAVNBody: TYPE ~ RECORD [
value: AbstractValue,
next: AbstractValue
];
AVNs
Constant.empty [ ];
Logical AVN
Constant.false [ ];
Constant.true [ ];
LogicalAVN: TYPE ~ REF LogicalAVNBody;
LogicalAVNBody: TYPE ~ RECORD [
value: BOOL
];
Numerical AVN
Constant.unbounded [ ];
Constant.number [ Number ];
Constant.inverted [ Number ];
Number.decimal [ decimal ];
Number.hex [ hex ];
Number.octal [ octal ];
NumericalAVN: TYPE ~ REF NumericalAVNBody;
NumericalAVNBody: TYPE ~ RECORD [
inverted: BOOL,
value: CARD32
];
Rope AVN
Constant.string [ rope ];
RopeAVN: TYPE ~ REF RopeAVNBody;
RopeAVNBody: TYPE ~ RECORD [
value: ROPE
];
Binding AVN
Binding [ NameList, Constant ];
BindingAVN: TYPE ~ REF BindingAVNBody;
BindingAVNBody: TYPE ~ RECORD [
tgn: TypeGraphNode,
node: AbstractValue
];
Constructor AVN
Constant.constructor [ Constructor ];
Constructor.one [ Binding ];
ConstructorAVN: TYPE ~ REF ConstructorAVNBody;
ConstructorAVNBody: TYPE ~ RECORD [
node: AbstractValue
];
Deref AVN
Constant.deref [ id ];
DerefAVN: TYPE ~ REF DerefAVNBody;
DerefAVNBody: TYPE ~ RECORD [
item: ROPE,
value: AbstractValue
];
Grouping AVN
Constant.grouping [ Grouping ];
Grouping.one [ Constant ];
GroupingAVN: TYPE ~ REF GroupingAVNBody;
GroupingAVNBody: TYPE ~ RECORD [
node: AbstractValue
];
Link AVN
Constant.import [ id.interface, id.item ];
LinkAVN: TYPE = REF LinkAVNBody;
LinkAVNBody: TYPE = RECORD [
interface: ROPE,
item: ROPE,
avn: AbstractValue
];
Variant AVN
Constant.choice [ id, Constant ];
VariantAVN: TYPE = REF VariantAVNBody;
VariantAVNBody: TYPE = RECORD [
id: ROPE,
node: AbstractValue
];
}.