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; ROPE: CedarType From Rope; STREAM: CedarType From IO; True: BaseFunction [] Returns [BOOLEAN]; False: BaseFunction [] Returns [BOOLEAN]; Error: BaseFunction [ROPE] Returns [BOOLEAN]; NullId: BaseFunction [] Returns [Id]; RopeFromId: BaseFunction [Id] Returns [ROPE]; RopeFromString: BaseFunction [String] Returns [ROPE]; ExpPTree: BaseType; NullExpPTree: BaseFunction [] Returns [ExpPTree]; ScopePTree: BaseType; ModulePPTree: BaseType; ReadDefFile: BaseFunction [ROPE] Returns [ModulePPTree]; DefBodyPTree: BaseType; Environment: BaseType; FakeDamageEnvironment: BaseFunction [Environment.arg] Returns [Environment.res] DamagedReps [Environment.arg]; CreateEmptyEnvironment: BaseFunction [] Returns [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]; InterfaceVal: BaseType; CreateInterfaceFromContextTree: BaseFunction [ContextTree, NameSequence] Returns [InterfaceVal]; 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 ]; 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; RootContextRib: BaseFunction [ ] Returns [ ContextRib ]; LocalContext: BaseType; CreateEmptyContext: BaseFunction [ ContextRib ] Returns [ LocalContext ]; FreezeLocalContext: BaseFunction [ LocalContext ] Returns [ ContextRib ] DamagedReps [ LocalContext ]; FakeDamageContext: BaseFunction [ LocalContext.arg ] Returns [ LocalContext.res ] DamagedReps [ LocalContext.arg ]; 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]; TypeGraphNode: BaseType; 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 ]; AddArcFromLVTGNToTGN: BaseFunction [ LocalContext.arg, TypeGraphNode.from, AccessVal, TypeGraphNode.to, DefaultExp ] Returns [ LocalContext.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 ]; CreateEmptyEnumTypeTGN: BaseFunction [ LocalContext.arg, BOOLEAN.machineDependent ] Returns [ LocalContext.res, TypeGraphNode ] DamagedReps[ LocalContext.arg ]; AppendElementToEnumTypeTGN: BaseFunction [ LocalContext.arg, TypeGraphNode, Id, ExpPTree ] Returns [ LocalContext.res ] DamagedReps[ LocalContext.arg ]; CreateVariantPartTGN: BaseFunction [LocalContext.arg, VariantFlavor, TypeGraphNode.tag, UnionList] Returns [ LocalContext.res, TypeGraphNode.var ] DamagedReps[ LocalContext.arg, UnionList ]; CreateSequenceTGN: BaseFunction [ LocalContext.arg, BOOLEAN, Id, PositionVal, AccessVal, TypeGraphNode.tag, TypeGraphNode.component] Returns [ LocalContext.res, TypeGraphNode.sequence ] DamagedReps[ LocalContext.arg ]; CreateSubrangeTGN: BaseFunction [ LocalContext.arg, TypeGraphNode.typeId, BoundsVal] 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 ]; CreateVarTGN: BaseFunction [ LocalContext.arg, TypeGraphNode.arg ] Returns [ LocalContext.res, TypeGraphNode.res ] DamagedReps[ LocalContext.arg ]; CreateListTGN: BaseFunction [ LocalContext.arg, BOOLEAN.readonly, TypeGraphNode.arg ] Returns [ LocalContext.res, TypeGraphNode.res ] DamagedReps[ LocalContext.arg ]; CreateArrayTGN: BaseFunction [ LocalContext.arg, BOOLEAN.packed, TypeGraphNode.index, TypeGraphNode.item] Returns [ LocalContext.res, TypeGraphNode.res ] DamagedReps[ LocalContext.arg ]; CreateDescriptorTGN: BaseFunction [ LocalContext.arg, BOOLEAN.readonly, TypeGraphNode.arg] 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 ]; CreateRelativeTGN: BaseFunction [ LocalContext.arg, TypeGraphNode.base, TypeGraphNode.arg] Returns [ LocalContext.res, TypeGraphNode.res ] DamagedReps[ LocalContext.arg ]; CreateZoneTGN: BaseFunction [ LocalContext.arg, BOOLEAN.uncounted] Returns [ LocalContext.res, TypeGraphNode ] DamagedReps[ LocalContext.arg ]; CreateLongTGN: BaseFunction [ LocalContext.arg, TypeGraphNode.arg] Returns [ LocalContext.res, TypeGraphNode.res ] DamagedReps[ LocalContext.arg ]; FindFrameTGN: BaseFunction [ LocalContext, Id] Returns [ TypeGraphNode ]; CreateSpecianatedTGNUsingExp: BaseFunction [ LocalContext.arg, TypeGraphNode.underlyingType, ExpPTree] Returns [ LocalContext.res, TypeGraphNode.res ] DamagedReps[ LocalContext.arg ]; CreateSpecianatedTGNUsingId: BaseFunction [ LocalContext.arg, TypeGraphNode.underlyingType, Id] Returns [ LocalContext.res, TypeGraphNode.res ] DamagedReps[ LocalContext.arg ]; CreateOpaqueTGN: BaseFunction [LocalContext.arg, Paint, ExpPTree] Returns [ LocalContext.res, TypeGraphNode.res ] DamagedReps[ LocalContext.arg ]; Field: BaseType; FieldList: BaseType; FrozenFieldList: BaseType; AnyFieldList: BaseFunction [ ] Returns [ FieldList ]; CreateNamedField: BaseFunction [ Id, PositionVal, AccessVal, TypeGraphNode, DefaultExp ] Returns [ Field ]; CreateUnnamedField: BaseFunction [ TypeGraphNode, DefaultExp ] Returns [ Field ]; CreateEmptyFieldList: BaseFunction [ ] Returns [ FieldList ]; AppendFieldToFieldList: BaseFunction [FieldList.arg, Field ] Returns [ FieldList.res ] DamagedReps[ FieldList.arg ]; FreezeFieldList: BaseFunction [LocalContext.arg, FieldList ] Returns [ LocalContext.res, FrozenFieldList ] DamagedReps[ LocalContext.arg, FieldList ]; 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, ExpPTree.lower, ExpPTree.upper, ROPE.rightparen] Returns [ BoundsVal ]; PositionVal: BaseType; NullPosition: BaseFunction [ ] Returns [ PositionVal ]; PositionValFun: BaseFunction [ ExpPTree, BoundsVal] Returns [ PositionVal ]; AccessVal: BaseType; AccessValConst: BaseFunction [ ROPE ] Returns [ AccessVal ]; NullAccessVal: BaseFunction [] Returns [ AccessVal ]; DefaultExp: BaseType; DefaultExpVal: BaseFunction [ROPE.case, ExpPTree] Returns [DefaultExp]; NullDefaultVal: BaseFunction [] Returns [DefaultExp]; NameSequence: BaseType; EmptyNameSequence: BaseFunction [] Returns [NameSequence]; InsertNameOnNameSequence: BaseFunction [Id, NameSequence.arg] Returns [NameSequence.res] DamagedReps [NameSequence.arg]; End. 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 GenericToken Misc ExpPTrees are used to bundle up Exps from the Abstract parse tree so that they can be passed around. ScopePTrees are used to bundle up Scopes from the Abstract parse tree so that they can be passed around. Environment Interfaces 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 LocalContext ContextTree TypeGraphNode Fields and FieldLists 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 NameSequence eof... Κa˜šœ™Icode™;Jšœ!Οk™$Kšœ,™/Kšœ,™,Kšœ"™%—J˜šΟnœ˜head–%clearTabStops 18 sp flushLeft tabStopšΟz ™ K–%clearTabStops 18 sp flushLeft tabStopšž œΠiz œ˜*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šœ  œ˜Kšœ  œ˜Kšœ  œ œ˜Kšœ  œ œœ˜šŸ™Kšžœ  œ œœ˜(Kšžœ  œ œœ˜)Kš žœ  œœ œœ˜-Kšžœ  œ œ˜%K˜šΟb ˜ Jš  œ˜Jš œœ˜J˜—š‘˜Jš  œ ˜Jš œœ˜J˜—K™dKšžœ œ˜Kšž œ  œ œ ˜1K™hKšž œ œ˜š‘ œ œ˜J˜š‘ ˜ Jš  œœ˜Jš œ˜—J˜—Jš‘ œ œ˜K˜—šŸ ™ š‘ œΟiœ˜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š  œ:˜FKš œ'˜.Kš  œ˜!—K˜šž˜Kš  œP˜\Kš œ˜Kš  œ˜!K˜—šž ˜ Kš  œ!˜-Kš œ"˜)Kš  œ˜ K˜—K™.šžœ™Kš  œ-™9Kš œ™—K˜K™+š‘˜Jš  œ0˜Jš œ˜Jš  œ˜ J˜—š‘˜Jš  œ@˜LJš œ(˜/Jš  œ ˜+J˜—š‘œ˜Jš  œœI˜qJš œ-˜4Jš  œ˜ J˜—š‘œ˜Jš  œ6˜BJš œ(˜/Jš  œ˜ J˜—š‘œ˜Jš  œœ œœ˜pJš œ'˜.Jš  œ˜ J˜—š‘ œ˜ Jš  œ(˜4Jš œ(˜/Jš  œ˜ J˜—š‘ œ˜Jš  œœ˜FJš œ(˜/Jš  œ˜ J˜—š‘œ˜Jš  œœ1˜YJš œ(˜/Jš  œ˜ J˜—š‘œ˜Jš  œœ˜EJš œ(˜/Jš  œ˜ J˜—š‘œ˜Jš  œœœ=˜pJš œ$˜+Jš  œ˜ J˜—š‘œ˜Jš  œ;˜GJš œ(˜/Jš  œ˜ J˜—š‘ œ˜Jš  œ'˜3Jš œ$˜+Jš  œ˜ J˜—š‘ œ˜Jš  œ'˜3Jš œ(˜/Jš  œ˜ J˜—š‘ œ˜ Jš  œ˜ Jš œ˜J˜—š‘˜Jš  œ<˜HJš œ(˜/Jš  œ˜ J˜—š‘˜Jš  œ6˜BJš œ(˜/Jš  œ˜ J˜—š‘˜Jš  œ$˜0Jš œ(˜/Jš  œ˜ ———šŸ™Jšžœ œ˜Jšž œ œ˜šžœ œ˜J˜š‘ ˜ Jš  œ˜Jš œ˜J˜—š‘œ˜Jš  œ:˜FJš œ ˜J˜—š‘œ˜Jš  œ˜*Jš œ ˜J˜—š‘œ˜Jš  œ˜Jš œ˜J˜—š‘œ˜Jš  œ˜$Jš œ˜Jš  œ˜J˜—š‘œ˜Jš  œ˜+Jš œ&˜-Jš  œ ˜+———šŸ™šž œ œ˜J˜š‘œ˜Jš  œ˜Jš œ˜J˜—š‘œ˜Jš  œ&˜2Jš œ˜Jš  œ˜J˜——šž œ œ˜J˜š‘˜Jš  œ˜Jš œ˜J˜—š‘˜Jš  œ˜Jš œ˜J˜—š‘˜Jš  œ˜)Jš œ˜J˜———šŸ™šžœ œ˜š‘œ˜Jš  œ˜!Jš œ˜#Jš  œ˜ J˜—š‘œ˜Jš  œ˜!Jš œ˜#š  œ˜ J™n————šŸ™šΠbn ‘œ œ˜J˜š‘ ˜ Jš  œ˜Jš œ˜J˜—š‘ œ˜ Jš  œœ,œ ˜O—Jš œ˜J™4——šŸ™š€ ‘œ œ˜J˜š‘ ˜ Jš  œ˜Jš œ˜J˜—š‘˜Jš  œ˜#Jš œ˜———šŸ™š€ ‘œ œ˜J˜š‘œ˜Jš  œœ˜Jš œ˜J˜—š‘˜Jš  œ˜Jš œ˜J˜———šŸ™Jšž œ œ˜˜š‘ œ˜Jš  œœ˜"Jš œ˜J™j—š‘˜Jš  œ˜Jš œ˜———LšŸ ™ š‘   œ˜K˜š‘˜Kš  œ˜Kš œ˜K˜—š‘˜Kš  œ˜#Kš œ˜Kš  œ˜——J˜—J˜J™—…—%8B™