SaffronGeneric: Module = Begin 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; 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]; MakeUnparsedNullValue: BaseFunction [] Returns [Value]; ScopePTree: BaseType; ModulePPTree: BaseType; ReadDefFile: BaseFunction [ROPE] Returns [ModulePPTree]; DefBodyPTree: BaseType; TypeExpPTree: BaseType; BogusTypeExpPTree: BaseFunction [] Returns [TypeExpPTree]; InitializationPTree: BaseType; DeclarationPTree: BaseType; 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]; InterfaceVal: BaseType; LookupInterfaceEntry: BaseFunction [TypeGraphNode.named, 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 ]; 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 ]; ContextRib: BaseType; SetUpRootContext: BaseFunction [CompilerState.arg] Returns [ContextRib, CompilerState.res] DamagedReps [CompilerState.arg]; LocalContext: BaseType; CreateEmptyContext: BaseFunction [ ContextRib, BOOLEAN.newFrame ] Returns [ LocalContext ]; FreezeLocalContext: BaseFunction [ LocalContext, TypeGraphNode.contents] Returns [ ContextRib ] DamagedReps [ LocalContext ]; FakeDamageContext: BaseFunction [ LocalContext.arg ] Returns [ LocalContext.res ] DamagedReps [ LocalContext.arg ]; ParentRib: BaseFunction [LocalContext] Returns [ContextRib]; 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: 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]; CreateArrayTGN: BaseFunction [ LocalContext.arg, BOOLEAN.packed, TypeGraphNode.index, TypeGraphNode.item] Returns [ LocalContext.res, TypeGraphNode.res ] DamagedReps[ LocalContext.arg ]; CreateBlockTGN: BaseFunction [LocalContext.arg, FrozenFieldList] Returns [LocalContext.res, TypeGraphNode.res] DamagedReps [LocalContext.arg]; CreateDescriptorTGN: BaseFunction [ LocalContext.arg, BOOLEAN.readonly, TypeGraphNode.arg] Returns [ LocalContext.res, TypeGraphNode.res ] DamagedReps[ LocalContext.arg ]; 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]; CreateIdentifierTGN: BaseFunction [LocalContext.arg, Id] Returns [LocalContext.res, TypeGraphNode.res] DamagedReps [LocalContext.arg]; CreateImplementationTGN: BaseFunction [LocalContext.arg, BOOLEAN.cedar, TypeGraphNode.transferType, ROPE.locks, ROPE.imports, ROPE.exports, ROPE.shares] Returns [LocalContext.res, TypeGraphNode.res] DamagedReps [LocalContext.arg]; CreateInterfaceTGN: BaseFunction [LocalContext.arg, BOOLEAN.cedar, ROPE.locks, ROPE.imports, ROPE.shares] Returns [LocalContext.res, TypeGraphNode.res] DamagedReps [LocalContext.arg]; CreateInterfaceContentsTGN: BaseFunction [LocalContext.arg, FrozenFieldList.contents] Returns [LocalContext.res, TypeGraphNode.res] DamagedReps [LocalContext.arg]; CreateListTGN: BaseFunction [ LocalContext.arg, BOOLEAN.readonly, TypeGraphNode.arg ] Returns [ LocalContext.res, TypeGraphNode.res ] DamagedReps[ LocalContext.arg ]; CreateLongTGN: BaseFunction [ LocalContext.arg, TypeGraphNode.arg] Returns [ LocalContext.res, TypeGraphNode.res ] DamagedReps[ LocalContext.arg ]; CreateModuleTGN: BaseFunction [LocalContext.arg, FrozenFieldList.contents] Returns [LocalContext.res, TypeGraphNode] DamagedReps [LocalContext.arg]; CreateNamedTGN: BaseFunction [LocalContext.arg, Id, PositionVal, AccessVal, TypeGraphNode.arg, DefaultExp] Returns [LocalContext.res, TypeGraphNode.res] DamagedReps[ LocalContext.arg ]; CreateOpaqueTGN: BaseFunction [LocalContext.arg, Paint, Value] Returns [ LocalContext.res, TypeGraphNode.res ] DamagedReps[ LocalContext.arg ]; CreatePointerTGN: BaseFunction [ LocalContext.arg, BOOLEAN.ordered, BOOLEAN.base, BoundsVal, BOOLEAN.readonly, TypeGraphNode.arg ] Returns [ LocalContext.res, TypeGraphNode.res] DamagedReps[ LocalContext.arg ]; CreateRecordTGN: BaseFunction [ LocalContext.arg, Paint, BOOLEAN.machineDependent, BOOLEAN.monitored, FrozenFieldList ] Returns [ LocalContext.res, TypeGraphNode ] DamagedReps[ LocalContext.arg ]; CreateRefTGN: BaseFunction [ LocalContext.arg, BOOLEAN.machineDependent, TypeGraphNode.referent ] Returns [ LocalContext.res, TypeGraphNode.ref ] DamagedReps[ LocalContext.arg ]; CreateRelativeTGN: BaseFunction [ LocalContext.arg, TypeGraphNode.base, TypeGraphNode.arg] Returns [ LocalContext.res, TypeGraphNode.res ] DamagedReps[ LocalContext.arg ]; CreateSequenceTGN: BaseFunction [ LocalContext.arg, BOOLEAN, Id, PositionVal, AccessVal, TypeGraphNode.tag, TypeGraphNode.component] Returns [ LocalContext.res, TypeGraphNode.sequence ] DamagedReps[ LocalContext.arg ]; 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 ]; CreateTransferTGN: BaseFunction [ LocalContext.arg, BOOLEAN.safe, ROPE.transferMode, FrozenFieldList.input, FrozenFieldList.output] Returns [ LocalContext.res, TypeGraphNode ] DamagedReps[ LocalContext.arg ]; CreateVarTGN: BaseFunction [ LocalContext.arg, TypeGraphNode.arg ] Returns [ LocalContext.res, TypeGraphNode.res ] DamagedReps[ LocalContext.arg ]; CreateVariantPartTGN: BaseFunction [LocalContext.arg, VariantFlavor, TypeGraphNode.tag, UnionList] Returns [ LocalContext.res, TypeGraphNode.var ] DamagedReps[ LocalContext.arg, UnionList ]; CreateZoneTGN: BaseFunction [ LocalContext.arg, BOOLEAN.uncounted] Returns [ LocalContext.res, TypeGraphNode ] DamagedReps[ LocalContext.arg ]; FindFrameTGN: BaseFunction [ LocalContext, Id] Returns [ TypeGraphNode ]; 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: BaseType; FieldList: BaseType; FrozenFieldList: BaseType; 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]; 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]; CreateNamedField: BaseFunction [ Id, PositionVal, AccessVal, TypeGraphNode, DefaultExp ] Returns [ Field ]; CreateUnnamedField: BaseFunction [ TypeGraphNode, DefaultExp ] Returns [ Field ]; DemandTypeDeclarationField: BaseFunction [Field] Returns [AccessVal, TypeGraphNode]; DemandConstantField: BaseFunction [Field] Returns [AccessVal, TypeGraphNode, InitializationPTree, Value]; DemandConstantOrVariableField: BaseFunction [Field] Returns [AccessVal, TypeGraphNode, InitializationPTree, BOOLEAN.isItAConstantField]; FieldExists: BaseFunction [Field] Returns [BOOLEAN]; FieldType: BaseFunction [Field] Returns [TypeGraphNode]; LookupNameInFieldList: BaseFunction [FieldList, Id] Returns [Field]; LookupNameInContextRib: BaseFunction [Id, ContextRib] Returns [Field]; 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: BaseType; GetUnpaintedPaint: BaseFunction [ LocalContext.arg ] Returns [ LocalContext.res, Paint ] DamagedReps[ LocalContext.arg ]; GetUniquePaint: BaseFunction [ LocalContext.arg ] Returns [ LocalContext.res, Paint ] DamagedReps[ LocalContext.arg ]; BoundsVal: BaseType; NullBounds: BaseFunction [ ] Returns [ BoundsVal ]; BoundsValFun: BaseFunction [ ROPE.leftparen, Value.lower, Value.upper, ROPE.rightparen] Returns [ BoundsVal ]; PositionVal: BaseType; NullPosition: BaseFunction [ ] Returns [ PositionVal ]; PositionValFun: BaseFunction [ Value, BoundsVal] Returns [ PositionVal ]; AccessVal: BaseType; AccessValConst: BaseFunction [ ROPE ] Returns [ AccessVal ]; NullAccessVal: BaseFunction [] Returns [ AccessVal ]; FakeCopyAccessVal: BaseFunction [AccessVal.arg] Returns [AccessVal.res]; DefaultExp: BaseType; DefaultExpVal: BaseFunction [ROPE.case, Value] Returns [DefaultExp]; NullDefaultVal: BaseFunction [] Returns [DefaultExp]; NameSequence: BaseType; EmptyNameSequence: BaseFunction [] Returns [NameSequence]; InsertNameOnNameSequence: BaseFunction [Id, NameSequence.arg] Returns [NameSequence.res] DamagedReps [NameSequence.arg]; 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]; ProgramGraph: BaseType; ProcedureGraph: BaseType; ProgramFragment: BaseType; ParameterizedFieldDescriptor: BaseType; RelationOp: EnumeratedBaseType = {eq, ne, lt, le, gt, ge}; TargetArchitecture: CedarType From SaffronTargetArchitecture; DemandNumber: BaseFunction [Value.arg] Returns [Value.res] SharedReps [Value.arg, Value.res]; ConformsToInteger: BaseFunction [TypeGraphNode] Returns [BOOLEAN]; DemandBoolean: BaseFunction [Value.arg] Returns [Value.res] SharedReps [Value.arg, Value.res]; 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]; 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]; CompileLValueIntoRValue: BaseFunction [ParameterizedFieldDescriptor, ContextTree] Returns [Value]; GetPathToName: BaseFunction [ContextTree, Id] Returns [ParameterizedFieldDescriptor, TypeGraphNode]; 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]; FindAFieldCorrespondingToDeclaration: BaseFunction [ContextTree, DeclarationPTree] Returns [Field]; CompileDefaultInitialization: BaseFunction [TypeGraphNode] Returns [Value]; End. $ZSaffronBaseDecls.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 GenericToken Misc ExpPTrees are used to bundle up Exps from the Abstract parse tree so that they can be passed around. ExpPTree: BaseType; ScopePTrees are used to bundle up Scopes from the Abstract parse tree so that they can be passed around. Environment 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 CreateInterfaceFromContextTree: BaseFunction [ContextTree, NameSequence] Returns [InterfaceVal]; LookupInterfaceEntry: BaseFunction [InterfaceVal, Id] Returns [AccessVal, TypeGraphNode]; 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) 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 Create a local context rib containing the predefined Cedar types. Install the appropriate pointers into the compiler state. LocalContext contents should be a module TGN, block TGN, or interface TGN ContextTree TypeGraphNode 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 Block Descriptor Element Identifier Implementation this should also take a locks argument and a monitor-vs-program argument... Interface Note that locks, imports, and shares are crocked. InterfaceContents List Long Module SetModuleLocalContextContents: BaseFunction [LocalContext.arg, TypeGraphNode, FrozenFieldList] Returns [LocalContext.res] DamagedReps [LocalContext.arg]; Named Opaque Pointer Record Ref Relative Sequence Specianated Transfer Var Variant Part and Union List Zone Value Field Lists Field List Constructors Field Constructors fields know about the parse tree of their defining declarations, because we need a way to find a field given a declaration. Operations on Fields 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...) If Field is not a constant declaration field, raise a fatal error. Otherwise, return the field's accessVal, type, initialization expression, and value. 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). The lookup functions return a NIL field if they don't find anything; this function tests for these NIL fields. A slight crock, this function returns the type graph node associated with a field. Looking Up Names Return the field in FieldList named Id, or a NIL field if Id isn't defined in FieldList. Return the most deeply nested, lexically visible field in ContextRib named Id, or a NIL field if Id isn't defined anywhere in ContextRib. Other Stuff Variant Parts and Unions Paint (doesn't really damage LocalContext.arg, but makes for easier writing of some function bodies, e.g., MakeType) Bounds The ROPEs are the parens : "[" or "(" and "]" or ")" Position Access Default case indicates which type of default is specified - "","_","_e","_TRASH","_e|TRASH" - see Mesa manual 3.25 DefaultExpVal: BaseFunction [ROPE.case, ExpPTree] Returns [DefaultExp]; case indicates which type of default is specified - "","_","_e","_TRASH","_e|TRASH" - see Mesa manual 3.25 NameSequence Dependencies AnalyzeDependencies: BaseFunction [LocalContext.foo] Returns [LocalContext.bar]; Compiler State this has to be replaced! SetDefaultAccess: BaseFunction [CompilerState.arg, AccessVal] Returns [CompilerState.res] DamagedReps [CompilerState.arg]; Program Graph All ProgramGraph-related functions are defined in SaffronProgramGraphDecls.ThreeC4 Compiling Expressions InitializationKind: EnumeratedBaseType = {constant, variable}; Target Architecture, etc. Type Conformance If the argument is a number, return the argument. Otherwise report an error and return a garbage instance with a number type. If the argument is a BOOLEAN, return the argument. Otherwise report an error and return a garbage instance with a BOOLEAN type. Type Size Dependency Analysis Looking Things Up LookupTypeNameInLocalContext: BaseFunction [LocalContext, Id] Returns [TypeGraphNode]; LookupTypeNameInContextTree: BaseFunction [ContextTree, Id] Returns [TypeGraphNode]; LookupVariableOrConstantName: BaseFunction [LocalContext, Id] Returns [Value]; Compiling Statements and Blocks AddDeclarationsToLocalContext: BaseFunction [FieldList, LocalContext.arg, CompilerState] Returns [LocalContext.res] DamagedReps [LocalContext.arg]; Κ""˜šœ™Icode™;Jšœ!Οk™$Kšœ,™/Kšœ,™,Kšœ"™%KšΟn œ.™:—J˜šžœΠizœŸ˜head–%clearTabStops 18 sp flushLeft tabStopšŸ ™ K–%clearTabStops 18 sp flushLeft tabStopšž œŸ œ˜*K–%clearTabStops 18 sp flushLeft tabStopšžœŸ œ˜&K–%clearTabStops 18 sp flushLeft tabStopšžœŸ œ˜"K–%clearTabStops 18 sp flushLeft tabStopšžœŸ œ ˜K–%clearTabStops 18 sp flushLeft tabStopšžœŸ œ˜#K–%clearTabStops 18 sp flushLeft tabStopšžœŸ œ˜"K–%clearTabStops 18 sp flushLeft tabStopšžœŸ œ˜!K–%clearTabStops 18 sp flushLeft tabStopšžœŸ œ˜!—K˜KšŸœ˜K˜—šž œŸœŸ˜J˜KšΠknœŸ œ˜Kš œŸ œ˜Kš œŸ œ˜Kš œŸ œ˜Kš  œŸ œ˜Kš œŸ œŸœ˜Kš œŸ œŸœœ˜KšžœŸ œŸœ˜&KšžœŸ œŸœ ˜$šœ™Kš žœŸ œœŸœœ˜-KšžœŸ œŸœ˜%K˜KšžœŸ œŸœœ˜+KšžœŸ œŸœœ˜-Kš žœŸ œœœŸœœ˜@Kš žœŸ œœœŸœœ˜?Kš žœŸ œœŸœœ˜6K˜KšžœŸ œŸœŸœ ˜OKšžœŸ œŸœŸœ ˜OKšžœŸ œŸœŸœ ˜OKšžœŸ œŸœŸœ ˜OKšžœŸ œŸœŸœ ˜OKšžœŸ œ ŸœŸœ ˜FK˜šΠbn Οb˜ JšŸ œ˜JšŸœœ˜J˜—š‘’˜JšŸ œ ˜JšŸœœ˜J˜—šž’˜KšŸ œ ˜KšŸœœ˜K˜—šž’˜KšŸ œ ˜KšŸœœ˜K˜—šž’˜KšŸ œ ˜KšŸœœ˜K˜—šž ’˜KšŸ œ˜KšŸœœ˜K˜—šž œ˜ KšŸ œ˜KšŸœ ˜K˜—šž œ˜ KšŸ œœ˜KšŸœ˜ K˜—K™dKšžœŸœ™KšžœŸ œŸœ ˜7K™hKšž œŸœ˜š‘ œŸœ˜J˜š‘ ’˜ JšŸ œœ˜JšŸœ˜—J˜—Jš‘ œŸœ˜J˜šž œŸœ˜J˜JšžœŸ œŸœ˜:J˜—JšžœŸœ˜J˜JšžœŸœ˜K˜—šœ ™ š‘ œŸœ˜K˜š‘’˜KšŸ œ˜KšŸœ˜KšŸ œ˜K˜—šžœ˜KšŸ œ˜KšŸœ˜K˜—šž'œ˜(KšŸ œœ˜:KšŸœ˜KšŸ œ˜K˜—šž*œ˜+KšŸ œœ%˜HKšŸœ˜KšŸ œ˜K˜—šžœ˜KšŸ œœ ˜)KšŸœ ˜K˜—šžœ˜KšŸ œœ ˜)KšŸœ˜K˜—šžœ˜KšŸ œœ˜;KšŸœ˜K˜—šžœ™KšŸ œœ™2KšŸœ™KšŸ œ™K™—šžœ™KšŸ œœ™ KšŸœ™K™—šžœ™KšŸ œœ™ KšŸœœ™———šœ ™ š‘ œŸœ˜K˜šžœ™KšŸ œ™(KšŸœ™K™—šžœ˜KšŸ œ˜&KšŸœ˜#K˜—šžœ™KšŸ œ™KšŸœ™#K™—šžœ˜KšŸ œ˜KšŸœ"˜)KšŸ œ˜!K˜—š‘ ’œ˜KšŸ œ:˜FKšŸœ'˜.KšŸ œ˜!—K˜šžœ˜KšŸ œP˜\KšŸœ˜KšŸ œ˜!K˜—šžœ˜ KšŸ œ!˜-KšŸœ"˜)KšŸ œ˜ K˜—K™.šžœ™KšŸ œ-™9KšŸœ™—K˜KšœŸœ™+š‘’˜JšŸ œ0˜K˜——Lšœ™Jš‘œŸ œŸœ˜>J˜šœ™šž œ˜ K™KšŸ œ ˜KšŸœ ˜KšŸ œ˜"K˜—šžœ˜KšŸ œ˜KšŸœœ˜K˜—šž œ˜KšœœWœ™KšŸ œ ˜KšŸœ ˜KšŸ œ˜"K˜—L™—šœ ™ šž œ˜ KšŸ œ3˜?KšŸœ ˜K˜—šž œ˜KšŸ œ3˜?KšŸœ ˜K˜—šž œ˜KšŸ œ3˜?KšŸœ ˜K˜——šœ™KšžœŸœ˜KšžœŸœ˜K˜šžœ˜KšŸ œ˜"KšŸœ˜KšŸ œ˜"K˜—šžœ˜KšŸ œ/˜;KšŸœ˜KšŸ œ˜"K˜—šžœ˜KšŸ œ/˜;KšŸœ˜KšŸ œ˜"K˜—šžœ˜KšŸ œ/˜;KšŸœ˜KšŸ œ˜"K˜—šžœ˜KšŸ œ+˜7KšŸœ˜KšŸ œ˜"K˜—šžœ˜KšŸ œ/˜;KšŸœ˜KšŸ œ˜"—K˜—šœ™šžœ™KšŸ œ™KšŸœ™K™—šžœ™KšŸ œ™KšŸœ™K™—šžœ™KšŸ œ™KšŸœ ™K™—šžœ˜KšŸ œ,˜8KšŸœ ˜K˜—šž œ˜KšŸ œ˜KšŸœ/˜6———šœ™šžœ˜KšŸ œ˜*KšŸœ˜KšŸ œ˜K˜—šžœ˜KšŸ œ˜*KšŸœ˜KšŸ œ˜K˜—šžœ˜KšŸ œ˜&KšŸœ˜K˜—šžœ˜KšŸ œB˜NKšŸœ"˜)KšŸ œ#˜.K˜—šžœ˜KšŸ œ"˜.KšŸœ˜KšŸ œ˜K˜—K˜šžœ™KšŸ œ-™9KšŸœ™KšŸ œ™K™—šž$œ˜%KšŸ œ ˜,KšŸœ ˜K˜—šžœ˜KšŸ œ˜KšŸœ ˜K˜—K˜J˜JšŸœ˜——…—Iˆ