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
Include [ SaffronBaseDecls ];
SaffronTreeDecls: Module = Begin
Environments and Interfaces
DoTop:
The main top-level function
TreeRecursiveFunction [ Tree, ROPE, Environment.arg ]
Returns [ Environment.res, InterfaceVal ]
DamagedReps [Environment.arg];
Explore:
A top-level function which enters included files in the environment but does no other work
TreeRecursiveFunction [Tree, ROPE, Environment.arg]
Returns [Environment.res, InterfaceVal]
DamagedReps [Environment.arg];
MakeEnvironment:
This is the main function, in fact. DoTop simply calls this.
TreeRecursiveFunction [Tree, ROPE, Environment.arg]
Returns [Environment.res, InterfaceVal]
DamagedReps [Environment.arg];
ProcessDirectoryClause:
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.
TreeRecursiveFunction [Tree, LocalContext.arg, Environment.arg]
Returns [ LocalContext.res, Environment.res]
DamagedReps [ LocalContext.arg, Environment.arg];
ExploreDirectoryClause:
Like ProcessDirectoryClause except that only ExploreEnvironment is applied to the new file.
TreeRecursiveFunction [Tree, Environment.arg]
Returns [Environment.res]
DamagedReps [Environment.arg];
MakeInterfaceTGN:
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)
TreeRecursiveFunction [Tree, LocalContext.arg, InterfaceVal]
Returns [ LocalContext.res, TypeGraphNode ]
DamagedReps [ LocalContext.arg ];
AddIdsToInterfaceTGN:
Applied to IdList. Calls the base function AddTGNToInterfaceTGN for each Id.
TreeRecursiveFunction [Tree, LocalContext.arg, TypeGraphNode.interface, InterfaceVal]
Returns [ LocalContext.res]
DamagedReps [ LocalContext.arg ];
Context Trees
MakeContextTree:
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.
TreeRecursiveFunction [ Tree, ContextRib, BOOLEAN.PaintRecords ]
Returns [ ContextTree ];
MakeContextTree1:
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.
TreeRecursiveFunction [ Tree, ContextRib, BOOLEAN.PaintRecords ]
Returns [ ContextTree ];
MakeBindListContextTreeWithScope:
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.
TreeRecursiveFunction [ Tree.bindList, ScopePTree, ContextRib, BOOLEAN.PaintRecords ]
Returns [ ContextTree ];
MakeBindListContextTreeWithDefBody:
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.
TreeRecursiveFunction [ Tree.bindList, DefBodyPTree, ContextRib, BOOLEAN.PaintRecords ]
Returns [ ContextTree ];
HangContextsFromContextTree:
Each Scope hangs the ContextTrees for nested Scopes from its own ContextTree.
TreeRecursiveFunction [ Tree, ContextTree.arg, ContextRib, BOOLEAN.PaintRecords ]
Returns [ ContextTree.res ]
DamagedReps [ ContextTree.arg ];
LocalContext
UpdateLocalContext:
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
TreeRecursiveFunction [ Tree, LocalContext.arg, BOOLEAN.PaintRecords ]
Returns [ LocalContext.res ]
DamagedReps [ LocalContext.arg ];
PutNewNamesInLocalContext:
This function is applied to DecList and Declaration on a 'first pass' that finds all the locally visible type names.
TreeRecursiveFunction [ Tree, LocalContext.arg ]
Returns [ LocalContext.res ]
DamagedReps [ LocalContext.arg ];
PutNewNamesInLocalContext1:
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.
TreeRecursiveFunction [ Tree, LocalContext.arg, AccessVal ]
Returns [ LocalContext.res ]
DamagedReps [ LocalContext.arg ];
FillInLocalContext:
This function implements the 'second pass' of UpdateLocalContext and fills in the type information for the previously recorded type names in the currect context.
TreeRecursiveFunction [ Tree, LocalContext.arg, BOOLEAN.PaintRecords ]
Returns [ LocalContext.res ]
DamagedReps [ LocalContext.arg ];
RecAddArcsfromLVTGNtoTGN:
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.
TreeRecursiveFunction [ Tree, LocalContext.arg, AccessVal, TypeGraphNode, DefaultExp ]
Returns [ LocalContext.res ]
DamagedReps [ LocalContext.arg ];
Type Construction
MakeType:
TreeRecursiveFunction [ Tree, LocalContext.a, BOOLEAN.PaintRecords]
Returns [ LocalContext.b, TypeGraphNode ]
DamagedReps [ LocalContext.a ];
LookupTypeId:
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.
TreeRecursiveFunction [ Tree, LocalContext.arg]
Returns [ LocalContext.res, TypeGraphNode ]
DamagedReps [ LocalContext.arg ];
MakeArgumentLists:
For Transfer types.
TreeRecursiveFunction [ Tree, LocalContext.a, BOOLEAN.PaintRecords ]
Returns [ LocalContext.b, FrozenFieldList.input, FrozenFieldList.output ]
DamagedReps [ LocalContext.a ];
MakeFieldList:
For Record type constructors.
TreeRecursiveFunction [ Tree, LocalContext.a, BOOLEAN.PaintRecords ]
Returns [ LocalContext.b, FieldList ]
DamagedReps [ LocalContext.a ];
AddPairsToFieldList:
For named field lists.
TreeRecursiveFunction [ Tree, LocalContext.a, FieldList.a, BOOLEAN.PaintRecords ]
Returns [ LocalContext.b, FieldList.b ]
DamagedReps [ LocalContext.a, FieldList.a ];
AddToFieldList:
For unnamed field lists.
TreeRecursiveFunction [ Tree, LocalContext.a, FieldList.a, BOOLEAN.PaintRecords ]
Returns [ LocalContext.b, FieldList.b ]
DamagedReps [ LocalContext.a, FieldList.a ];
AddNamesToFieldList:
This function is applied to IdList by AddPairsToFieldList and adds <Id, FrozenFieldList> pairs to the FieldList
TreeRecursiveFunction [ Tree, AccessVal, TypeGraphNode, DefaultExp, FieldList.a ]
Returns [ FieldList.b ]
DamagedReps [ FieldList.a ];
MakeElementList:
For enumerated types.
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];
Union and Sequence Types
MakeUnionList:
For Union types.
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:
This function is applied to IdList by AddVariantsToUnionList and adds Id, FrozenFieldList pairs to the UnionList
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:
This function makes an enumerated type from the Ids in a VariantList for * type Tag fields
TreeRecursiveFunction [Tree, LocalContext.a]
Returns [ LocalContext.b, TypeGraphNode ]
DamagedReps [ LocalContext.a ];
AddVariantNamesToEnumTypeTGN:
This function is applied to VariantList by MakeStarTagType to build an enumerated type
TreeRecursiveFunction [Tree, LocalContext.a, TypeGraphNode]
Returns [LocalContext.b]
DamagedReps [ LocalContext.a ];
MakeVariantFlavor:
Variants for Union types come in three flavors: Vanilla, Overlaid, Computed.
TreeRecursiveFunction [ Tree]
Returns [VariantFlavor ];
GetIdentInfo:
Currently only used by MakeVariantFlavor to obtain Id and Position from a tag Ident.
TreeRecursiveFunction [ Tree]
Returns [Id, PositionVal ];
GetSequenceTagInfo:
TreeRecursiveFunction [ Tree]
Returns [Id, PositionVal, AccessVal];
Name Sequences
MakeNameSequence:
TreeRecursiveFunction [Tree]
Returns [NameSequence];
AddNamesToSequence:
TreeRecursiveFunction [Tree, NameSequence.arg]
Returns [NameSequence.res]
DamagedReps [NameSequence.arg];
Miscellaneous
GetBoundsVal:
TreeRecursiveFunction [ Tree ]
Returns [ BoundsVal ];
GetLowerAndUpper:
This function is applied to Bounds by GetBoundsVal
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:
Produces an Id from an Exp if possible
TreeRecursiveFunction [ Tree ]
Returns [ Id ];
End.
eof...