Include [ SaffronBaseDecls ]; SaffronTreeDecls: Module = Begin DoTop: TreeRecursiveFunction [ Tree, ROPE, Environment.arg ] Returns [ Environment.res, InterfaceVal ] DamagedReps [Environment.arg]; Explore: TreeRecursiveFunction [Tree, ROPE, Environment.arg] Returns [Environment.res, InterfaceVal] DamagedReps [Environment.arg]; MakeEnvironment: TreeRecursiveFunction [Tree, ROPE, Environment.arg] Returns [Environment.res, InterfaceVal] DamagedReps [Environment.arg]; ProcessDirectoryClause: TreeRecursiveFunction [Tree, LocalContext.arg, Environment.arg] Returns [ LocalContext.res, Environment.res] DamagedReps [ LocalContext.arg, Environment.arg]; ExploreDirectoryClause: TreeRecursiveFunction [Tree, Environment.arg] Returns [Environment.res] DamagedReps [Environment.arg]; MakeInterfaceTGN: TreeRecursiveFunction [Tree, LocalContext.arg, InterfaceVal] Returns [ LocalContext.res, TypeGraphNode ] DamagedReps [ LocalContext.arg ]; AddIdsToInterfaceTGN: TreeRecursiveFunction [Tree, LocalContext.arg, TypeGraphNode.interface, InterfaceVal] Returns [ LocalContext.res] DamagedReps [ LocalContext.arg ]; MakeContextTree: TreeRecursiveFunction [ Tree, ContextRib, BOOLEAN.PaintRecords ] Returns [ ContextTree ]; MakeContextTree1: TreeRecursiveFunction [ Tree, ContextRib, BOOLEAN.PaintRecords ] Returns [ ContextTree ]; MakeBindListContextTreeWithScope: TreeRecursiveFunction [ Tree.bindList, ScopePTree, ContextRib, BOOLEAN.PaintRecords ] Returns [ ContextTree ]; MakeBindListContextTreeWithDefBody: TreeRecursiveFunction [ Tree.bindList, DefBodyPTree, ContextRib, BOOLEAN.PaintRecords ] Returns [ ContextTree ]; HangContextsFromContextTree: TreeRecursiveFunction [ Tree, ContextTree.arg, ContextRib, BOOLEAN.PaintRecords ] Returns [ ContextTree.res ] DamagedReps [ ContextTree.arg ]; UpdateLocalContext: TreeRecursiveFunction [ Tree, LocalContext.arg, BOOLEAN.PaintRecords ] Returns [ LocalContext.res ] DamagedReps [ LocalContext.arg ]; PutNewNamesInLocalContext: TreeRecursiveFunction [ Tree, LocalContext.arg ] Returns [ LocalContext.res ] DamagedReps [ LocalContext.arg ]; PutNewNamesInLocalContext1: TreeRecursiveFunction [ Tree, LocalContext.arg, AccessVal ] Returns [ LocalContext.res ] DamagedReps [ LocalContext.arg ]; FillInLocalContext: TreeRecursiveFunction [ Tree, LocalContext.arg, BOOLEAN.PaintRecords ] Returns [ LocalContext.res ] DamagedReps [ LocalContext.arg ]; RecAddArcsfromLVTGNtoTGN: TreeRecursiveFunction [ Tree, LocalContext.arg, AccessVal, TypeGraphNode, DefaultExp ] Returns [ LocalContext.res ] DamagedReps [ LocalContext.arg ]; MakeType: TreeRecursiveFunction [ Tree, LocalContext.a, BOOLEAN.PaintRecords] Returns [ LocalContext.b, TypeGraphNode ] DamagedReps [ LocalContext.a ]; LookupTypeId: TreeRecursiveFunction [ Tree, LocalContext.arg] Returns [ LocalContext.res, TypeGraphNode ] DamagedReps [ LocalContext.arg ]; MakeArgumentLists: TreeRecursiveFunction [ Tree, LocalContext.a, BOOLEAN.PaintRecords ] Returns [ LocalContext.b, FrozenFieldList.input, FrozenFieldList.output ] DamagedReps [ LocalContext.a ]; MakeFieldList: TreeRecursiveFunction [ Tree, LocalContext.a, BOOLEAN.PaintRecords ] Returns [ LocalContext.b, FieldList ] DamagedReps [ LocalContext.a ]; AddPairsToFieldList: TreeRecursiveFunction [ Tree, LocalContext.a, FieldList.a, BOOLEAN.PaintRecords ] Returns [ LocalContext.b, FieldList.b ] DamagedReps [ LocalContext.a, FieldList.a ]; AddToFieldList: TreeRecursiveFunction [ Tree, LocalContext.a, FieldList.a, BOOLEAN.PaintRecords ] Returns [ LocalContext.b, FieldList.b ] DamagedReps [ LocalContext.a, FieldList.a ]; AddNamesToFieldList: TreeRecursiveFunction [ Tree, AccessVal, TypeGraphNode, DefaultExp, FieldList.a ] Returns [ FieldList.b ] DamagedReps [ FieldList.a ]; MakeElementList: TreeRecursiveFunction [ Tree, LocalContext.arg, BOOLEAN.machineDependent ] Returns [ LocalContext.res, TypeGraphNode ] DamagedReps [ LocalContext.arg ]; ElementInfo: TreeRecursiveFunction [ Tree ] Returns [ Id, ExpPTree ]; GetPointerTypeInfo: TreeRecursiveFunction [ Tree, LocalContext.arg, BOOLEAN.PaintRecords ] Returns [ LocalContext.res, BoundsVal, BOOLEAN.readOnly, TypeGraphNode] DamagedReps [ LocalContext.arg ]; MakeTransferMode: TreeRecursiveFunction [ Tree ] Returns [ROPE]; MakeUnionList: TreeRecursiveFunction [ Tree, LocalContext.a, BOOLEAN.paintRecords] Returns [ LocalContext.b, UnionList ] DamagedReps [ LocalContext.a ]; AddVariantsToUnionList: TreeRecursiveFunction [ Tree, LocalContext.arg, UnionList.arg, BOOLEAN.paintRecords] Returns [LocalContext.res, UnionList.res] DamagedReps [LocalContext.arg, UnionList.arg]; AddNamesToUnionList: TreeRecursiveFunction [ Tree, FrozenFieldList, UnionList.arg] Returns [UnionList.res] DamagedReps [UnionList.arg]; MakeTagType: TreeRecursiveFunction [Tree, LocalContext.a, BOOLEAN.PaintRecords] Returns [ LocalContext.b, TypeGraphNode.tag, BOOLEAN.isStarTagType ] DamagedReps [ LocalContext.a ]; MakeStarTagType: TreeRecursiveFunction [Tree, LocalContext.a] Returns [ LocalContext.b, TypeGraphNode ] DamagedReps [ LocalContext.a ]; AddVariantNamesToEnumTypeTGN: TreeRecursiveFunction [Tree, LocalContext.a, TypeGraphNode] Returns [LocalContext.b] DamagedReps [ LocalContext.a ]; MakeVariantFlavor: TreeRecursiveFunction [ Tree] Returns [VariantFlavor ]; GetIdentInfo: TreeRecursiveFunction [ Tree] Returns [Id, PositionVal ]; GetSequenceTagInfo: TreeRecursiveFunction [ Tree] Returns [Id, PositionVal, AccessVal]; MakeNameSequence: TreeRecursiveFunction [Tree] Returns [NameSequence]; AddNamesToSequence: TreeRecursiveFunction [Tree, NameSequence.arg] Returns [NameSequence.res] DamagedReps [NameSequence.arg]; GetBoundsVal: TreeRecursiveFunction [ Tree ] Returns [ BoundsVal ]; GetLowerAndUpper: TreeRecursiveFunction [ Tree ] Returns [ ExpPTree.lower, ExpPTree.upper ]; GetExpVal: TreeRecursiveFunction [ Tree ] Returns [ ExpPTree ]; GetPositionVal: TreeRecursiveFunction [ Tree ] Returns [ PositionVal ]; GetAccessVal: TreeRecursiveFunction [ Tree ] Returns [ AccessVal ]; GetDefaultExpVal: TreeRecursiveFunction [ Tree ] Returns [ DefaultExp ]; GetBooleanVal: TreeRecursiveFunction [ Tree ] Returns [ BOOLEAN ]; IdVal: TreeRecursiveFunction [ Tree ] Returns [ Id ]; End. °SaffronTreeDecls.ThreeC4 Copyright Σ 1987 by Xerox Corporation. All rights reserved. Shoup, August 8, 1986 5:34:38 pm PDT Bill Jackson (bj) April 27, 1987 3:51:50 pm PDT Lucy Hederman August 21, 1987 11:48:22 am PDT Sturgis, July 21, 1987 3:23:25 pm PDT Environments and Interfaces The main top-level function A top-level function which enters included files in the environment but does no other work This is the main function, in fact. DoTop simply calls this. Applied to Directory and IncludeItem. For each IncludeItem, if the file does not already appear in the environment a parse tree for the specified file is obtained and the main function MakeEnvironment is applied to it, yielding an updated environment, and an interface for the file. Otherwise the interface for the file is retrieved from the envirpnment. The filename, a locally visible TGN and an interfaceTGN are then entered into the localContext. Like ProcessDirectoryClause except that only ExploreEnvironment is applied to the new file. Applied to Using clauses; Creates an empty interface TGN for the interface passed in and puts in the items mentioned if any, or just creates an interface TGN for the entire interface (if no Using clause) Applied to IdList. Calls the base function AddTGNToInterfaceTGN for each Id. Context Trees Each new scope is required to make a ContextTree. The basic algorithm is 1. Create an empty local context. 2. Update it - fill in the new information. 3. Freeze the local context into a rib. 4. Make a context tree with the rib. 5. Hang trees for nested contexts from it. Makes the Context Tree for everything in Scope other than the bindlist; i.e. it makes the context that is nested within bindList. This is needed because of the problem that semantically nested things are not syntactically nested. Used to pass the job of making a context tree onto the BindList Makes the Context Tree for a bindList and its nested context - everything else in Scope. Used to pass the job of making a context tree onto the DefBody Makes the Context Tree for a bindList and its nested context - everything else in DefBody. Each Scope hangs the ContextTrees for nested Scopes from its own ContextTree. LocalContext For DecList this function is implemented 'in two passes' with FillInLocalContext and PutNewNamesInLocalContext For BindList and Directory it is implemented by simple calls to base functions This function is applied to DecList and Declaration on a 'first pass' that finds all the locally visible type names. This function is applied to IdentList by PutNewNamesInLocalContext. It has the extra Access field: the access on a Declaration is common to all Ids in the Declaration. This function implements the 'second pass' of UpdateLocalContext and fills in the type information for the previously recorded type names in the currect context. This function does the work for FillInLocalContext; it is applied to IdentList, and associates each (previously recorded) type name (Id) with its TypeGraphNode and access and default values. Type Construction For TypeId type expressions. Might actually involve some creation of TGNs because not all possible variants and interface type TGNs are created when the variant record or interface is created. MakeType of a TypeId is implemented by this function - but this name seemed appropriate since the intention of a TypeId is that it should describe types that already exist. For Transfer types. For Record type constructors. For named field lists. For unnamed field lists. This function is applied to IdList by AddPairsToFieldList and adds pairs to the FieldList For enumerated types. Union and Sequence Types For Union types. This function is applied to IdList by AddVariantsToUnionList and adds Id, FrozenFieldList pairs to the UnionList This function makes an enumerated type from the Ids in a VariantList for * type Tag fields This function is applied to VariantList by MakeStarTagType to build an enumerated type Variants for Union types come in three flavors: Vanilla, Overlaid, Computed. Currently only used by MakeVariantFlavor to obtain Id and Position from a tag Ident. Name Sequences Miscellaneous This function is applied to Bounds by GetBoundsVal Produces an Id from an Exp if possible eof... Κ– "cedar" style˜codešœ™K™;Kšœ$™$K™/K™-K™%—K˜K˜K˜KšΟnœ˜ headšΟz™šΟbœ˜K™šΠizœ Οkœ ‘œ˜5Kš œ"˜)Kš  œ˜—K˜—šŸ˜K™Zš œ‘œ‘œ ‘œ˜3Kš œ ˜'Kš  œ˜K˜——šŸ˜K™<š œ‘œ‘œ ‘œ˜3Kš œ ˜'Kš  œ˜—K˜—šŸ˜K™βK™_š œ%‘œ˜?Kš œ%˜,Kš  œ ‘œ˜1—K˜—šŸ˜Kšœ[™[š œ‘œ˜-Kš œ˜Kš  œ ‘œ˜—K˜—šŸ˜K™Λš œ'˜K™Zš œ,‘œ˜WKš œ˜K˜——šŸœ˜K™Mš œ&‘œ˜QKš œ˜Kš  œ˜ ———šž ™ šŸœ˜Kšœn™nK™Nš œ‘œ‘ œ˜FKš œ˜Kš  œ˜!K˜——šŸœ˜K™tš œ˜0Kš œ˜Kš  œ˜!K˜——šŸœ˜Kšœ§™§š œ&˜;Kš œ˜Kš  œ˜!K˜——šŸœ˜K™‘š œ‘œ˜FKš œ˜Kš  œ˜!K˜——šŸœ˜KšœΎ™Ύš œA˜VKš œ˜Kš  œ˜!———šž™šŸœ˜ Kš œ‘œ˜CKš œ"˜)Kš  œ˜K˜—šŸ ˜ K™νKš œ˜/Kš œ$˜+Kš  œ˜!K˜—šŸœ˜K™Kš œ‘œ˜DKš œB˜IKš  œ˜K˜—šŸ œ˜K™Kš œ‘œ˜DKš œ˜%Kš  œ˜K˜—šŸœ˜K™š œ%‘œ˜QKš œ ˜'Kš  œ!˜,K˜——šŸœ˜K™š œ&‘œ˜QKš œ ˜'Kš  œ!˜,K˜——šŸœ˜Kšœo™oš œ<˜QKš œ˜Kš  œ˜K˜——šŸœ˜K™š œ‘œ˜JKš œ$˜+Kš  œ˜!K˜——šŸ œ˜ š œ ˜Kš œ˜K˜——šŸœ˜š œ‘œ‘ œ˜FKš œ ‘œ‘œ˜GKš  œ˜!K˜——šŸœ˜š œ ˜Kš œ‘œ˜———šž™šŸ œ˜K™Kš œ‘œ˜CKš œ˜%Kš  œ˜K˜—šŸ˜Kš œ*‘œ˜TKš œ"˜)Kš  œ#˜.K˜—šŸ˜Kšœp™pKš œ(˜=Kš œ˜Kš  œ˜K˜—šŸ ˜ š œ‘œ‘ œ˜BKš œ&‘œ‘ œ˜DKš  œ˜K˜——šŸ˜K™Zš œ˜,Kš œ"˜)Kš  œ˜K˜——šŸ˜KšœV™Vš œ&˜;Kš œ˜Kš  œ˜K˜——šŸœ˜K™Lš œ˜Kš œ˜—K˜—šŸ œ˜ KšœT™Tš œ˜Kš œ˜—K˜—šŸœ˜š œ˜Kš œ˜%———šž™šŸ˜š œ˜Kš œ˜K˜——šŸ˜š œ˜.Kš œ˜Kš  œ˜———šž ™ šŸ œ˜ š œ ˜Kš œ˜K˜——šŸœ˜Kšœ2™2š œ ˜Kš œ$˜+K˜——šŸ ˜ š œ ˜Kš œ˜K˜——šŸŸœ˜š œ ˜Kš œ˜K˜——šŸ œ˜ š œ ˜Kš œ˜K˜——šŸœ˜š œ ˜Kš œ˜K˜——šŸ œ˜š œ ˜Kš œ‘œ˜K˜——šŸœ˜K™&š œ ˜Kš œ˜K˜——K˜—K˜K™—…—N1