next up previous contents
Next: Statements Up: An introduction to the Previous: Scoping and Global Symbols   Contents

Types, QualifiedTypes, and DataTypes

The class from which all types derive is Type. From this are derived four types: QualifiedType for symbols, DataType for expressions, ProcedureType for procedures, and LabelType for labels.

QualifiedType is used for declaring symbols. A qualified type can simply be a pointer to a type, or it can be a pointer to a type with qualifications, such as "const". Attributes such as C's "volatile" are also handled in this way, even though this is not really type information. "static" is handled by setting the is_static field in a symbol definition to true, not by entering "static" in the qualifications. A qualified type will never point to another qualified type. There is a module TypeBuilder which will enforce this if you use its methods to build qualified types.

DataType is used for values of expressions. For example, when a variable is loaded, the type of the load expression is the type pointed at by the qualified type.

Current the ProcedureType has only one derived type: CProcedureType. Procedures represented by this class follow the procedure linkage convention of C. Procedures in SUIF are represented by Symbols. A procedure symbol has a type and may have a definition.


next up previous contents
Next: Statements Up: An introduction to the Previous: Scoping and Global Symbols   Contents
David Heine
1999-11-22