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; BooleanConst: BaseFunction[ROPE] Returns[BOOLEAN]; LocalContext: BaseType; CreateEmptyContext: BaseFunction [ ] Returns [ LocalContext ]; FakeDamageContext: BaseFunction [ LocalContext.arg ] Returns [ LocalContext.res ] DamagedReps [ LocalContext.arg ]; TypeGraphNode: BaseType; FindBottomTGN: BaseFunction [ LocalContext ] Returns [ TypeGraphNode ]; FindLocallyVisibleTGN: BaseFunction [ LocalContext, Id ] Returns [ TypeGraphNode ]; CreateLocallyVisibleTGN: BaseFunction [ LocalContext.arg, Id ] Returns [ LocalContext.res, TypeGraphNode ] DamagedReps[ LocalContext.arg ]; AddArcFromLVTGNToTGN: BaseFunction [ LocalContext.arg, TypeGraphNode.from, TypeGraphNode.to ] Returns [ LocalContext.res ] DamagedReps[ LocalContext.arg ]; CreateRecordTGN: BaseFunction [ LocalContext.arg, Paint, FrozenFieldList ] Returns [ LocalContext.res, TypeGraphNode ] DamagedReps[ LocalContext.arg ]; CreateRefTGN: BaseFunction [ LocalContext.arg, TypeGraphNode.load, TypeGraphNode.store ] Returns [ LocalContext.res, TypeGraphNode.ref ] DamagedReps[ LocalContext.arg ]; CreateEmptyEnumTypeTGN: BaseFunction [ LocalContext.arg ] Returns [ LocalContext.res, TypeGraphNode ] DamagedReps[ LocalContext.arg ]; AppendElementToEnumTypeTGN: BaseFunction [ LocalContext.arg, TypeGraphNode, Id ] Returns [ LocalContext.res ] DamagedReps[ LocalContext.arg ]; Field: BaseType; FieldList: BaseType; FrozenFieldList: BaseType; CreateNamedField: BaseFunction [ Id, TypeGraphNode ] Returns [ Field ]; CreateUnnamedField: BaseFunction [ TypeGraphNode ] 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 ]; Paint: BaseType; GetUnpaintedPaint: BaseFunction [ LocalContext.arg ] Returns [ LocalContext.res, Paint ] DamagedReps[ LocalContext.arg ]; GetUniquePaint: BaseFunction [ LocalContext.arg ] Returns [ LocalContext.res, Paint ] DamagedReps[ LocalContext.arg ]; End. NSaffronBaseDecls.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 July 17, 1987 5:47:51 pm PDT Sturgis, July 21, 1987 3:19:59 pm PDT GenericToken Misc 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. LocalContext TypeGraphNode Fields and FieldLists Paint (doesn't really damage LocalContext.arg, but makes for easier writing of some function bodies, e.g., MakeType) eof... Κψ˜šœ™Icode™;Jšœ$™$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š œŸ œ œŸœ œ˜2—šž™Jšœε œΟgœ™’J™Jšœu œ œ œΗ™κJ™Jšœ œX™pJ™JšœΦ™ΦJ™Jš œ³™ΊL™šž ™ Jš œŸœ˜J˜šΟbœ˜JšŸ œ˜JšŸœ˜J˜—š’œ˜JšŸ œ˜"JšŸœ˜JšŸ œ˜!J˜———šž ™ š œŸœ˜J˜š œ˜JšŸ œ˜JšŸœ˜J˜—šœ˜JšŸ œ˜!JšŸœ˜J˜—J˜J˜šœ˜JšŸ œ˜%JšŸœ$˜+JšŸ œ˜ J˜—šœ˜JšŸ œ;˜GJšŸœ˜JšŸ œ˜ J˜—šœ˜JšŸ œ-˜9JšŸœ$˜+JšŸ œ˜ J˜—š œ˜ JšŸ œ>˜JJšŸœ(˜/JšŸ œ˜ J˜—šΠbnœ˜JšŸ œ˜!JšŸœ$˜+JšŸ œ˜ J˜—š£œ˜JšŸ œ(˜4JšŸœ˜JšŸ œ˜ J˜——šž™JšŸœ˜Jš œŸœ˜JšœŸœ˜J˜šœ˜JšŸ œ˜"JšŸœ ˜J˜—šœ˜JšŸ œ˜JšŸœ ˜J˜—šœ˜JšŸ œ˜JšŸœ˜J˜—šœ˜JšŸ œ˜$JšŸœ˜JšŸ œ˜J˜—šœ˜JšŸ œ˜+JšŸœ&˜-JšŸ œ ˜+J˜—J˜——J˜šž™JšœŸœ˜J˜šœ˜JšŸ œ˜!JšŸœ˜#JšŸ œ˜ J˜—šœ˜JšŸ œ˜!JšŸœ˜#šŸ œ˜ J™n—J˜—J˜—J˜J˜—J˜J™—…— 2x