SaffronBaseDecls.ThreeC4
Copyright Ó 1987 by Xerox Corporation. All rights reserved.
Shoup, August 8, 1986 5:53:23 pm PDT
Bill Jackson (bj) April 27, 1987 3:45:56 pm PDT
Lucy Hederman August 17, 1987 2:54:00 pm PDT
Sturgis, July 21, 1987 3:19:59 pm PDT
Last edited by: James Rauen August 25, 1988 3:27:10 pm PDT
SaffronGeneric: Module = Begin
GenericToken
Decimalnum: GenericToken = "tokenDECIMAL";
Octalnum: GenericToken = "tokenOCTAL";
Hexnum: GenericToken = "tokenHEX";
Id: GenericToken = "tokenID";
String: GenericToken = "tokenROPE";
Flnum: GenericToken = "tokenREAL";
Char: GenericToken = "tokenCHAR";
Atom: GenericToken = "tokenATOM";
End;
SaffronBase: Module = Begin
BOOLEAN:  CedarType;
INT:  CedarType;
ATOM:  CedarType;
REAL:  CedarType;
CHARACTER: CedarType;
ROPE:  CedarType From Rope;
STREAM:  CedarType From IO;
BigCARD:  CedarType From BigCardinals;
BigINT:  CedarType From BigIntegers;
Misc
Error: BaseFunction [ROPE] Returns [BOOLEAN];
NullId: BaseFunction [] Returns [Id];
True: BaseFunction []    Returns [BOOLEAN];
False:  BaseFunction []    Returns [BOOLEAN];
And:  BaseFunction [BOOLEAN.a, BOOLEAN.b] Returns [BOOLEAN.res];
Or:  BaseFunction [BOOLEAN.a, BOOLEAN.b] Returns [BOOLEAN.res];
Not:  BaseFunction [BOOLEAN.a]  Returns [BOOLEAN.res];
Add: CedarFunction [BigINT.a, BigINT.b] Returns [BigINT.res] From BigIntegers;
Sub: CedarFunction [BigINT.a, BigINT.b] Returns [BigINT.res] From BigIntegers;
Mul: CedarFunction [BigINT.a, BigINT.b] Returns [BigINT.res] From BigIntegers;
Div: CedarFunction [BigINT.a, BigINT.b] Returns [BigINT.res] From BigIntegers;
Mod: CedarFunction [BigINT.a, BigINT.b] Returns [BigINT.res] From BigIntegers;
Neg: CedarFunction [BigINT.a]  Returns [BigINT.res] From BigIntegers;
RopeFromId:
BaseFunction [Id]
Returns [ROPE];
RopeFromString:
BaseFunction [String]
Returns [ROPE];
RopeFromDecimalnum:
BaseFunction [Decimalnum]
Returns [ROPE];
RopeFromOctalnum:
BaseFunction [Octalnum]
Returns [ROPE];
RopeFromHexnum:
BaseFunction [Hexnum]
Returns [ROPE];
RopeFromFlnum:
BaseFunction [Flnum]
Returns [ROPE];
StringFromId:
BaseFunction [Id]
Returns [String];
IdFromRope:
BaseFunction [ROPE]
Returns [Id];
ExpPTrees are used to bundle up Exps from the Abstract parse tree so that they can be passed around.
ExpPTree: BaseType;
MakeUnparsedNullValue: BaseFunction [] Returns [Value];
ScopePTrees are used to bundle up Scopes from the Abstract parse tree so that they can be passed around.
ScopePTree: BaseType;
ModulePPTree:  BaseType;
ReadDefFile:
BaseFunction [ROPE]
Returns [ModulePPTree];
DefBodyPTree:  BaseType;
TypeExpPTree: BaseType;
BogusTypeExpPTree: BaseFunction [] Returns [TypeExpPTree];
InitializationPTree: BaseType;
DeclarationPTree: BaseType;
Environment
Environment: BaseType;
FakeDamageEnvironment:
BaseFunction [Environment.arg]
Returns [Environment.res]
DamagedReps [Environment.arg];
CreateEmptyEnvironment:
BaseFunction []
Returns [Environment];
AddCompiledDefinitionsFileToEnvironment:
BaseFunction [Environment.arg, ROPE.fileName, ContextTree]
Returns [Environment.res]
DamagedReps [Environment.arg];
AddCompiledImplementationFileToEnvironment:
BaseFunction [Environment.arg, ROPE.fileName, ContextTree, ProgramGraph]
Returns [Environment.res]
DamagedReps [Environment.arg];
IsCompiledFileInEnv:
BaseFunction [Environment, ROPE.fileName]
Returns [BOOLEAN];
LookupCompiledFileInEnv:
BaseFunction [Environment, ROPE.fileName]
Returns [ContextTree];
LookupInterfaceInEnv:
BaseFunction [Environment, ROPE.fileName, Id.interfaceName]
Returns [TypeGraphNode];
AddInterfaceToEnvironment:
BaseFunction [Environment.arg, ROPE, InterfaceVal]
Returns [Environment.res]
DamagedReps [Environment.arg];
LookupInterfaceInEnv:
BaseFunction [Environment, ROPE]
Returns [InterfaceVal];
IsInterfaceInEnv:
BaseFunction [Environment, ROPE]
Returns [BOOLEAN];
Interfaces
InterfaceVal: BaseType;
CreateInterfaceFromContextTree:
BaseFunction [ContextTree, NameSequence]
Returns [InterfaceVal];
LookupInterfaceEntry:
BaseFunction [TypeGraphNode.named, Id]
Returns [AccessVal, TypeGraphNode];
LookupInterfaceEntry:
BaseFunction [InterfaceVal, Id]
Returns [AccessVal, TypeGraphNode];
CreateEmptyInterfaceTGN:
BaseFunction [LocalContext.arg]
Returns [LocalContext.res, TypeGraphNode]
DamagedReps [ LocalContext.arg ];
CreateLinkTGN:
BaseFunction [LocalContext.arg, TypeGraphNode.entry, InterfaceVal, Id]
Returns [LocalContext.res, TypeGraphNode.link]
DamagedReps [ LocalContext.arg ];
AddTGNToInterfaceTGN:
BaseFunction [LocalContext.arg, TypeGraphNode.interface, Id, AccessVal, TypeGraphNode.entry]
Returns [LocalContext.res]
DamagedReps [ LocalContext.arg ];
CreateInterfaceTGNFromInterface:
BaseFunction [LocalContext.arg, InterfaceVal]
Returns [LocalContext.res, TypeGraphNode]
DamagedReps [LocalContext.arg ];
I will have to use this function at some point
LookupTypeNameInInterfaceTGN:
BaseFunction [LocalContext, Id, TypeGraphNode.interface ]
Returns [TypeGraphNode.res];
Next two functions used for Open (BindList)
RenameInterface:
BaseFunction [LocalContext.arg, Id, TypeGraphNode.interface]
Returns [ LocalContext.res ]
DamagedReps[ LocalContext.arg ];
OpenInterface:
BaseFunction [LocalContext.arg, TypeGraphNode.interface]
Returns [ LocalContext.res ]
DamagedReps[ LocalContext.arg ];
Context
A LocalContext is a mathematical structure. It has a universe of nodes of varying types. In the mathematical world, the recursion equations define a specific representative of the isomorphism class of that mathematical structure. The universe of that representative consists of some subset of the integers. In the implementation to be constructed here, the "index" field of a node contains the node value to be used in the mathematical world. i.e., if n is a node representation, ER(n) is simply n.index and F(n) = n.index.
We assume that when an operation on a LocalContext, lc, involves nodes of that structure, these will be nodes within ER(lc). The implementation checks for this. The key reason that this works is that under these conditions, the rest of the body of n is in the ER(lc), even though not in ER(n). This requires a slight modification to the assumptions in the paper. In particular, definition 7.3 makes too strong a requirement. The conclusions of def 7.3 need only follow for some recursion equations, not all. Exactly how to state this I have not yet figured out. I will write a more detailed justification later.
Notice that we assume ER(n) is unmodifiable, thus there is no sharing between n and its containing LocalContext.
In addition, we remark that one need not actually include the index field in the implementation, or the checks. Presumably one has proven that for all reachable configurations the check will succeed, hence one need not perform it. Second, the code never looks at the index field, hence if the field is removed then the resulting computation will be isomorphic to a computation including the index field. Hence, the resulting LocalContext representation will be isomorphic to the representation of the computation that includes the field, hence isomorphic to the result in the mathematical world.
WARNING: All of the above leads to the following remarks. Some of the mathematical values below are represented by a rather indirect means, namely a pointer to a record with a field containing the value. (Or without the field...) Other mathematical values are reprsenented by large data structures that include some of the records just described. Whenever an operation is to be performed on more than one mathematical value, where the representations have this form, then one must always be sure that all the records involved belong to the same large data structure.
ContextRib
ContextRib: BaseType;
SetUpRootContext:
Create a local context rib containing the predefined Cedar types. Install the appropriate pointers into the compiler state.
BaseFunction [CompilerState.arg]
Returns [ContextRib, CompilerState.res]
DamagedReps [CompilerState.arg];
LocalContext
LocalContext: BaseType;
CreateEmptyContext:
BaseFunction [ ContextRib, BOOLEAN.newFrame ]
Returns [ LocalContext ];
FreezeLocalContext:
contents should be a module TGN, block TGN, or interface TGN
BaseFunction [ LocalContext, TypeGraphNode.contents]
Returns [ ContextRib ]
DamagedReps [ LocalContext ];
FakeDamageContext:
BaseFunction [ LocalContext.arg ]
Returns [ LocalContext.res ]
DamagedReps [ LocalContext.arg ];
ParentRib:
BaseFunction [LocalContext]
Returns [ContextRib];
ContextTree
ContextTree: BaseType;
EmptyContextTree:
BaseFunction [ ContextRib ]
Returns [ ContextTree ];
AddSubContextTree:
BaseFunction [ ContextTree.tree, ContextTree.subtree ]
Returns [ContextTree]
DamagedReps [ContextTree.tree];
FakeDamageContextTree:
BaseFunction [ ContextTree.arg ]
Returns [ ContextTree.res ]
DamagedReps [ContextTree.arg];
Rib:
BaseFunction [ContextTree]
Returns [ContextRib];
TypeGraphNode
TypeGraphNode: BaseType;
TypeGraphNodeList: BaseType;
AddIdToRestrictionList:
BaseFunction [Id, TypeGraphNode.arg]
Returns [TypeGraphNode.res]
DamagedReps [TypeGraphNode.arg];
AddAllIdsToRestrictionList:
BaseFunction [TypeGraphNode.arg]
Returns [TypeGraphNode.res]
DamagedReps [TypeGraphNode.arg];
FakeDamageTypeGraphNode:
BaseFunction [TypeGraphNode.arg]
Returns [TypeGraphNode.res]
DamagedReps [TypeGraphNode.arg];
FindBottomTGN:
BaseFunction [ LocalContext ]
Returns [ TypeGraphNode ];
FindTopTGN:
BaseFunction [ LocalContext ]
Returns [ TypeGraphNode ];
FindLocallyVisibleTGN:
BaseFunction [ LocalContext, Id ]
Returns [ TypeGraphNode ];
CreateLocallyVisibleTGN:
BaseFunction [ LocalContext.arg, Id, AccessVal ]
Returns [ LocalContext.res, TypeGraphNode ]
DamagedReps[ LocalContext.arg ];
AddVariableName:
BaseFunction [ LocalContext.arg, Id, AccessVal, BOOLEAN ]
Returns [ LocalContext.res]
DamagedReps[ LocalContext.arg ];
AddArcFromLVTGNToTGN:
BaseFunction [ LocalContext.arg, TypeGraphNode.from, AccessVal, TypeGraphNode.to, DefaultExp ]
Returns [ LocalContext.res ]
DamagedReps[ LocalContext.arg ];
AddArcFromLocalNameToInstance:
BaseFunction [ LocalContext.arg, Id, AccessVal, Instance ]
Returns [ LocalContext.res ]
DamagedReps[ LocalContext.arg ];
AddNamedTypeToFieldList:
BaseFunction [Id, AccessVal, FieldList.arg, TypeGraphNode]
Returns [FieldList.res]
DamagedReps [FieldList.arg];
AddConstantNameToFieldList:
BaseFunction [Id, AccessVal, FieldList.arg]
Returns [FieldList.res]
DamagedReps [FieldList.arg];
AddVariableNameToFieldList:
BaseFunction [Id, AccessVal, FieldList.arg]
Returns [FieldList.res]
DamagedReps [FieldList.arg];
ConnectNamedTypeToTGN:
BaseFunction [LocalContext.arg, Id, AccessVal, TypeGraphNode, DefaultExp]
Returns [LocalContext.res]
DamagedReps [LocalContext.arg];
FillInConstantName:
BaseFunction [LocalContext.arg, Id, AccessVal, TypeGraphNode, Value]
Returns [LocalContext.res]
DamagedReps [LocalContext.arg];
FillInVariableName:
BaseFunction [LocalContext.arg, Id, AccessVal, TypeGraphNode, DefaultExp]
Returns [LocalContext.res]
DamagedReps [LocalContext.arg];
Specific Types and Values
Array
CreateArrayTGN:
BaseFunction [ LocalContext.arg, BOOLEAN.packed, TypeGraphNode.index, TypeGraphNode.item]
Returns [ LocalContext.res, TypeGraphNode.res ]
DamagedReps[ LocalContext.arg ];
Block
CreateBlockTGN:
BaseFunction [LocalContext.arg, FrozenFieldList]
Returns [LocalContext.res, TypeGraphNode.res]
DamagedReps [LocalContext.arg];
Descriptor
CreateDescriptorTGN:
BaseFunction [ LocalContext.arg, BOOLEAN.readonly, TypeGraphNode.arg]
Returns [ LocalContext.res, TypeGraphNode.res ]
DamagedReps[ LocalContext.arg ];
Element
CreateSubrangeTGN:
BaseFunction [ LocalContext.arg, TypeGraphNode.typeId, BoundsVal]
Returns [ LocalContext.res, TypeGraphNode.res ]
DamagedReps[ LocalContext.arg ];
CreateEmptyEnumTypeTGN:
BaseFunction [ LocalContext.arg, BOOLEAN.machineDependent ]
Returns [ LocalContext.res, TypeGraphNode ]
DamagedReps[ LocalContext.arg ];
AppendElementToEnumTypeTGN:
BaseFunction [ LocalContext.arg, TypeGraphNode, Id, Value ]
Returns [ LocalContext.res ]
DamagedReps[ LocalContext.arg ];
First:
BaseFunction [TypeGraphNode]
Returns [Value];
Last:
BaseFunction [TypeGraphNode]
Returns [Value];
Identifier
CreateIdentifierTGN:
BaseFunction [LocalContext.arg, Id]
Returns [LocalContext.res, TypeGraphNode.res]
DamagedReps [LocalContext.arg];
Implementation
CreateImplementationTGN:
this should also take a locks argument and a monitor-vs-program argument...
BaseFunction [LocalContext.arg, BOOLEAN.cedar, TypeGraphNode.transferType, ROPE.locks, ROPE.imports, ROPE.exports, ROPE.shares]
Returns [LocalContext.res, TypeGraphNode.res]
DamagedReps [LocalContext.arg];
Interface
CreateInterfaceTGN:
Note that locks, imports, and shares are crocked.
BaseFunction [LocalContext.arg, BOOLEAN.cedar, ROPE.locks, ROPE.imports, ROPE.shares]
Returns [LocalContext.res, TypeGraphNode.res]
DamagedReps [LocalContext.arg];
InterfaceContents
CreateInterfaceContentsTGN:
BaseFunction [LocalContext.arg, FrozenFieldList.contents]
Returns [LocalContext.res, TypeGraphNode.res]
DamagedReps [LocalContext.arg];
List
CreateListTGN:
BaseFunction [ LocalContext.arg, BOOLEAN.readonly, TypeGraphNode.arg ]
Returns [ LocalContext.res, TypeGraphNode.res ]
DamagedReps[ LocalContext.arg ];
Long
CreateLongTGN:
BaseFunction [ LocalContext.arg, TypeGraphNode.arg]
Returns [ LocalContext.res, TypeGraphNode.res ]
DamagedReps[ LocalContext.arg ];
Module
CreateModuleTGN:
BaseFunction [LocalContext.arg, FrozenFieldList.contents]
Returns [LocalContext.res, TypeGraphNode]
DamagedReps [LocalContext.arg];
SetModuleLocalContextContents:
BaseFunction [LocalContext.arg, TypeGraphNode, FrozenFieldList]
Returns [LocalContext.res]
DamagedReps [LocalContext.arg];
Named
CreateNamedTGN:
BaseFunction [LocalContext.arg, Id, PositionVal, AccessVal, TypeGraphNode.arg, DefaultExp]
Returns [LocalContext.res, TypeGraphNode.res]
DamagedReps[ LocalContext.arg ];
Opaque
CreateOpaqueTGN:
BaseFunction [LocalContext.arg, Paint, Value]
Returns [ LocalContext.res, TypeGraphNode.res ]
DamagedReps[ LocalContext.arg ];
Pointer
CreatePointerTGN:
BaseFunction [ LocalContext.arg, BOOLEAN.ordered, BOOLEAN.base, BoundsVal, BOOLEAN.readonly, TypeGraphNode.arg ]
Returns [ LocalContext.res, TypeGraphNode.res]
DamagedReps[ LocalContext.arg ];
Record
CreateRecordTGN:
BaseFunction [ LocalContext.arg, Paint, BOOLEAN.machineDependent, BOOLEAN.monitored, FrozenFieldList ]
Returns [ LocalContext.res, TypeGraphNode ]
DamagedReps[ LocalContext.arg ];
Ref
CreateRefTGN:
BaseFunction [ LocalContext.arg, BOOLEAN.machineDependent, TypeGraphNode.referent ]
Returns [ LocalContext.res, TypeGraphNode.ref ]
DamagedReps[ LocalContext.arg ];
Relative
CreateRelativeTGN:
BaseFunction [ LocalContext.arg, TypeGraphNode.base, TypeGraphNode.arg]
Returns [ LocalContext.res, TypeGraphNode.res ]
DamagedReps[ LocalContext.arg ];
Sequence
CreateSequenceTGN:
BaseFunction [ LocalContext.arg, BOOLEAN, Id, PositionVal, AccessVal, TypeGraphNode.tag, TypeGraphNode.component]
Returns [ LocalContext.res, TypeGraphNode.sequence ]
DamagedReps[ LocalContext.arg ];
Specianated
CreateSpecianatedTGNUsingExp:
BaseFunction [ LocalContext.arg, TypeGraphNode.underlyingType, Value]
Returns [ LocalContext.res, TypeGraphNode.res ]
DamagedReps[ LocalContext.arg ];
CreateSpecianatedTGNUsingId:
BaseFunction [ LocalContext.arg, TypeGraphNode.underlyingType, Id]
Returns [ LocalContext.res, TypeGraphNode.res ]
DamagedReps[ LocalContext.arg ];
Transfer
CreateTransferTGN:
BaseFunction [ LocalContext.arg, BOOLEAN.safe, ROPE.transferMode, FrozenFieldList.input, FrozenFieldList.output]
Returns [ LocalContext.res, TypeGraphNode ]
DamagedReps[ LocalContext.arg ];
Var
CreateVarTGN:
BaseFunction [ LocalContext.arg, TypeGraphNode.arg ]
Returns [ LocalContext.res, TypeGraphNode.res ]
DamagedReps[ LocalContext.arg ];
Variant Part and Union List
CreateVariantPartTGN:
BaseFunction [LocalContext.arg, VariantFlavor, TypeGraphNode.tag, UnionList]
Returns [ LocalContext.res, TypeGraphNode.var ]
DamagedReps[ LocalContext.arg, UnionList ];
Zone
CreateZoneTGN:
BaseFunction [ LocalContext.arg, BOOLEAN.uncounted]
Returns [ LocalContext.res, TypeGraphNode ]
DamagedReps[ LocalContext.arg ];
FindFrameTGN:
BaseFunction [ LocalContext, Id]
Returns [ TypeGraphNode ];
Value
Value: BaseType;
Static: BaseFunction [Value] Returns [BOOLEAN];
Type: BaseFunction [Value] Returns [TypeGraphNode] SharedReps [Value, TypeGraphNode];
Code: BaseFunction [Value] Returns [ProgramFragment] SharedReps [Value, ProgramFragment];
IsTrash: BaseFunction [Value] Returns [BOOLEAN];
ChangeType:
BaseFunction [Value.arg, TypeGraphNode]
Returns [Value.res]
DamagedReps [Value.arg];
RopeFromValue: BaseFunction [Value] Returns [ROPE];
MakeDummy: BaseFunction [ROPE] Returns [Value];
MakeTrash: BaseFunction [TypeGraphNode] Returns [Value];
MakeDefaultMeValue: BaseFunction [] Returns [Value];
MakeRuntimeValue: BaseFunction [ProgramFragment, TypeGraphNode] Returns [Value];
DummyBigINT: BaseFunction [] Returns [BigINT];
ParseIntegerLiteral: BaseFunction [ROPE, INT.radix] Returns [BigINT];
CastIntegerValue: BaseFunction [BigINT, TypeGraphNodeList] Returns [Value];
CanCastIntegerValue: BaseFunction [BigINT, TypeGraphNode] Returns [BOOLEAN];
RetrieveIntegerValue: BaseFunction [Value] Returns [BigINT];
MakeStaticBoolean: BaseFunction [BOOLEAN, TypeGraphNode] Returns [Value];
BooleanValue: BaseFunction [Value] Returns [BOOLEAN];
MakeStaticCharacter: BaseFunction [CHARACTER, TypeGraphNode] Returns [Value];
CharacterValue: BaseFunction [Value] Returns [CHARACTER];
Pred: BaseFunction [Value.arg] Returns [Value.res];
Succ: BaseFunction [Value.arg] Returns [Value.res];
MakeTransferValue:
BaseFunction [TypeGraphNode.transferType, ProcedureGraph]
Returns [Value];
Field Lists
Field: BaseType;
FieldList: BaseType;
FrozenFieldList: BaseType;
Field List Constructors
CreateEmptyFieldList:
BaseFunction [ ]
Returns [ FieldList ];
FakeDamageFieldList:
BaseFunction [FieldList.arg]
Returns [FieldList.res]
DamagedReps [FieldList.arg];
AnyFieldList:
BaseFunction [ ]
Returns [ FieldList ];
AppendFieldToFieldList:
BaseFunction [FieldList.arg, Field ]
Returns [ FieldList.res ]
DamagedReps[ FieldList.arg ];
FreezeFieldList:
BaseFunction [FieldList]
Returns [FrozenFieldList];
Field Constructors
FakeDamageField:
BaseFunction [Field.arg]
Returns [Field.res]
DamagedReps [Field.arg];
CreateNamedTypeField:
BaseFunction [Id, PositionVal, AccessVal, TypeGraphNode, TypeExpPTree]
Returns [Field];
CreateModuleField:
BaseFunction [Id, PositionVal, TypeGraphNode]
Returns [Field];
CreateConstantField:
BaseFunction [Id, PositionVal, DeclarationPTree, AccessVal, TypeGraphNode, InitializationPTree]
Returns [Field];
CreateVariableField:
BaseFunction [Id, PositionVal, DeclarationPTree, AccessVal, TypeGraphNode, InitializationPTree]
Returns [Field];
fields know about the parse tree of their defining declarations, because we need a way to find a field given a declaration.
CreateNamedField:
BaseFunction [ Id, PositionVal, AccessVal, TypeGraphNode, DefaultExp ]
Returns [ Field ];
CreateUnnamedField:
BaseFunction [ TypeGraphNode, DefaultExp ]
Returns [ Field ];
Operations on Fields
DemandTypeDeclarationField:
If Field is not a type declaration field, raise a fatal error. Otherwise, return the field's accessVal and tgn. (The tgn had better be a named tgn...)
BaseFunction [Field]
Returns [AccessVal, TypeGraphNode];
DemandConstantField:
If Field is not a constant declaration field, raise a fatal error. Otherwise, return the field's accessVal, type, initialization expression, and value.
BaseFunction [Field]
Returns [AccessVal, TypeGraphNode, InitializationPTree, Value];
DemandConstantOrVariableField:
If Field is neither a constant declaration field nor a variable declaration field, raise a fatal error. Otherwise, return the field's accessVal, type, initialization expression, and a BOOLEAN value. The BOOLEAN value is TRUE if the field is a constant declaration field and FALSE if the field is a variable declaration field. (To get the value of a manifest constant field, a call to DemandConstantField must also be made).
BaseFunction [Field]
Returns [AccessVal, TypeGraphNode, InitializationPTree, BOOLEAN.isItAConstantField];
FieldExists:
The lookup functions return a NIL field if they don't find anything; this function tests for these NIL fields.
BaseFunction [Field]
Returns [BOOLEAN];
FieldType:
A slight crock, this function returns the type graph node associated with a field.
BaseFunction [Field]
Returns [TypeGraphNode];
Looking Up Names
LookupNameInFieldList:
Return the field in FieldList named Id, or a NIL field if Id isn't defined in FieldList.
BaseFunction [FieldList, Id]
Returns [Field];
LookupNameInContextRib:
Return the most deeply nested, lexically visible field in ContextRib named Id, or a NIL field if Id isn't defined anywhere in ContextRib.
BaseFunction [Id, ContextRib]
Returns [Field];
Other Stuff
Variant Parts and Unions
UnionList: BaseType;
CreateEmptyUnionList:
BaseFunction [ ]
Returns [ UnionList ];
AppendToUnionList:
BaseFunction [UnionList.arg, Id, FrozenFieldList ]
Returns [ UnionList.res ]
DamagedReps[ UnionList.arg ];
VariantFlavor: BaseType;
OverlaidVariantFlavorConst:
BaseFunction [ ]
Returns [ VariantFlavor ];
ComputedVariantFlavorConst:
BaseFunction [ ]
Returns [ VariantFlavor ];
VanillaVariantFlavorVal:
BaseFunction [Id, PositionVal, AccessVal]
Returns [ VariantFlavor ];
Paint
Paint: BaseType;
GetUnpaintedPaint:
BaseFunction [ LocalContext.arg ]
Returns [ LocalContext.res, Paint ]
DamagedReps[ LocalContext.arg ];
GetUniquePaint:
BaseFunction [ LocalContext.arg ]
Returns [ LocalContext.res, Paint ]
DamagedReps[ LocalContext.arg ];
(doesn't really damage LocalContext.arg, but makes for easier writing of some function bodies, e.g., MakeType)
Bounds
BoundsVal: BaseType;
NullBounds:
BaseFunction [ ]
Returns [ BoundsVal ];
BoundsValFun:
BaseFunction [ ROPE.leftparen, Value.lower, Value.upper, ROPE.rightparen]
Returns [ BoundsVal ];
The ROPEs are the parens : "[" or "(" and "]" or ")"
Position
PositionVal: BaseType;
NullPosition:
BaseFunction [ ]
Returns [ PositionVal ];
PositionValFun:
BaseFunction [ Value, BoundsVal]
Returns [ PositionVal ];
Access
AccessVal: BaseType;
AccessValConst:
BaseFunction [ ROPE ]
Returns [ AccessVal ];
NullAccessVal:
BaseFunction []
Returns [ AccessVal ];
FakeCopyAccessVal:
BaseFunction [AccessVal.arg]
Returns [AccessVal.res];
Default
DefaultExp: BaseType;
DefaultExpVal:
BaseFunction [ROPE.case, Value]
Returns [DefaultExp];
case indicates which type of default is specified - "","←","𡤎","←TRASH","𡤎|TRASH" - see Mesa manual 3.25
DefaultExpVal:
BaseFunction [ROPE.case, ExpPTree]
Returns [DefaultExp];
case indicates which type of default is specified - "","←","𡤎","←TRASH","𡤎|TRASH" - see Mesa manual 3.25
NullDefaultVal:
BaseFunction []
Returns [DefaultExp];
NameSequence
NameSequence: BaseType;
EmptyNameSequence:
BaseFunction []
Returns [NameSequence];
InsertNameOnNameSequence:
BaseFunction [Id, NameSequence.arg]
Returns [NameSequence.res]
DamagedReps [NameSequence.arg];
Dependencies
AnalyzeDependencies:
BaseFunction [LocalContext.foo]
Returns [LocalContext.bar];
Compiler State
CompilerState: BaseType;
FakeDamageCompilerState:
BaseFunction [CompilerState.arg]
Returns [CompilerState.res]
DamagedReps [CompilerState.arg];
MakeCompilerState:
BaseFunction [TargetArchitecture, ROPE.options]
Returns [CompilerState];
GetTargetArchitecture:
BaseFunction [CompilerState]
Returns [TargetArchitecture];
GetRootContextRib:
BaseFunction [CompilerState]
Returns [ContextRib];
GetIntrinsicAtomType:
BaseFunction [CompilerState]
Returns [TypeGraphNode];
GetIntrinsicBooleanType:
BaseFunction [CompilerState]
Returns [TypeGraphNode];
GetIntrinsicCharacterType:
BaseFunction [CompilerState]
Returns [TypeGraphNode];
GetIntrinsicIntegerTypes:
BaseFunction [CompilerState]
Returns [TypeGraphNodeList];
GetIntrinsicRealTypes:
BaseFunction [CompilerState]
Returns [TypeGraphNodeList];
GetTop:
BaseFunction [CompilerState]
Returns [TypeGraphNode];
GetBottom:
BaseFunction [CompilerState]
Returns [TypeGraphNode];
GetDefaultAccess:
BaseFunction [CompilerState]
Returns [AccessVal];
this has to be replaced!
SetDefaultAccess:
BaseFunction [CompilerState.arg, AccessVal]
Returns [CompilerState.res]
DamagedReps [CompilerState.arg];
Program Graph
ProgramGraph: BaseType;
ProcedureGraph: BaseType;
ProgramFragment: BaseType;
ParameterizedFieldDescriptor: BaseType;
All ProgramGraph-related functions are defined in SaffronProgramGraphDecls.ThreeC4
Compiling Expressions
RelationOp: EnumeratedBaseType = {eq, ne, lt, le, gt, ge};
InitializationKind: EnumeratedBaseType = {constant, variable};
Target Architecture, etc.
TargetArchitecture:  CedarType From SaffronTargetArchitecture;
Type Conformance
DemandNumber:
If the argument is a number, return the argument. Otherwise report an error and return a garbage instance with a number type.
BaseFunction [Value.arg]
Returns [Value.res]
SharedReps [Value.arg, Value.res];
ConformsToInteger:
BaseFunction [TypeGraphNode]
Returns [BOOLEAN];
DemandBoolean:
If the argument is a BOOLEAN, return the argument. Otherwise report an error and return a garbage instance with a BOOLEAN type.
BaseFunction [Value.arg]
Returns [Value.res]
SharedReps [Value.arg, Value.res];
Type Size
NumberOfBits:
BaseFunction [TypeGraphNode, Value.nRepetitions, CompilerState]
Returns [Value.res];
NumberOfBytes:
BaseFunction [TypeGraphNode, Value.nRepetitions, CompilerState]
Returns [Value.res];
NumberOfWords:
BaseFunction [TypeGraphNode, Value.nRepetitions, CompilerState]
Returns [Value.res];
Dependency Analysis
DependencyGraph: BaseType;
DependencyGraphNode: BaseType;
FakeDamageDependencyGraph:
BaseFunction [DependencyGraph.arg]
Returns [DependencyGraph.res]
DamagedReps [DependencyGraph.arg];
AddSizeDependency:
BaseFunction [DependencyGraph.arg, DependencyGraphNode, Id]
Returns [DependencyGraph.res]
DamagedReps [DependencyGraph.arg];
AddFirstDependency:
BaseFunction [DependencyGraph.arg, DependencyGraphNode, Id]
Returns [DependencyGraph.res]
DamagedReps [DependencyGraph.arg];
AddLastDependency:
BaseFunction [DependencyGraph.arg, DependencyGraphNode, Id]
Returns [DependencyGraph.res]
DamagedReps [DependencyGraph.arg];
AddRuntimeDependency:
BaseFunction [DependencyGraph.arg, DependencyGraphNode]
Returns [DependencyGraph.res]
DamagedReps [DependencyGraph.arg];
AddValueDependency:
BaseFunction [DependencyGraph.arg, DependencyGraphNode, Id]
Returns [DependencyGraph.res]
DamagedReps [DependencyGraph.arg];
Looking Things Up
LookupTypeNameInLocalContext:
BaseFunction [LocalContext, Id]
Returns [TypeGraphNode];
LookupTypeNameInContextTree:
BaseFunction [ContextTree, Id]
Returns [TypeGraphNode];
LookupVariableOrConstantName:
BaseFunction [LocalContext, Id]
Returns [Value];
CompileLValueIntoRValue:
BaseFunction [ParameterizedFieldDescriptor, ContextTree]
Returns [Value];
GetPathToName:
BaseFunction [ContextTree, Id]
Returns [ParameterizedFieldDescriptor, TypeGraphNode];
Compiling Statements and Blocks
LookupIdentifierTGNs:
BaseFunction [FieldList.arg, LocalContext]
Returns [FieldList.res]
DamagedReps [FieldList.arg];
DiscernSpecianatedTGNs:
BaseFunction [FieldList.arg, LocalContext]
Returns [FieldList.res]
DamagedReps [FieldList.arg];
BuildDependencyGraph:
BaseFunction [FieldList, LocalContext]
Returns [DependencyGraph];
AnalyzeDependencies:
BaseFunction [DependencyGraph, FieldList.arg, LocalContext.arg, CompilerState]
Returns [FieldList.res, LocalContext.res]
DamagedReps [FieldList.arg, LocalContext.arg];
SetLocalContextContents:
BaseFunction [LocalContext.arg, TypeGraphNode]
Returns [LocalContext.res]
DamagedReps [LocalContext.arg];
AddDeclarationsToLocalContext:
BaseFunction [FieldList, LocalContext.arg, CompilerState]
Returns [LocalContext.res]
DamagedReps [LocalContext.arg];
FindAFieldCorrespondingToDeclaration:
BaseFunction [ContextTree, DeclarationPTree]
Returns [Field];
CompileDefaultInitialization:
BaseFunction [TypeGraphNode]
Returns [Value];
End.