Package scale.clef.type

Provides for describing the types of expressions and variables.

See:
          Description

Class Summary
AggregateType An aggregate type contains a list of fields (either field declarations or routine declarations).
ArrayType The abstract class for all array types.
AtomicType This class represents types directly supported by (most) hardware (e.g., integers, reals, and pointers).
BooleanType This class represents the boolean type.
Bound A Bound class represents a range of allowed values.
CharacterType This class represents the char type.
ClassType A class representing a class data structure.
ComplexType This class represents the complex type with a real and an imaginary part.
CompositeType This is the abstract class for types that are composed of multiple instances of other types such as arrays and structures.
EnumerationType This class represents a C style enumeration type.
FixedArrayType This class represents array types with fixed bounds.
FixedType The FixedType class represents scaled-arithmetic types.
FloatType This class repsents floating point types such as C's float and double types.
IncompleteType An IncompleteType is used to represent a type before the complete type is known.
IntegerType The IntegerType class represents a primitive integer type.
MethodType A class representing a method's Type.
NumericType This is the base class for all numeric types.
OffsetType A class which represents a pointer-to-member as found in C++.
PointerType The PointerType represents the type address of some other type.
ProcedureType A ProcedureType represents the type of a procedure.
Raise A raise represents an exception that may be thrown by a procedure.
RaiseWithObject ???.
RaiseWithType ???.
RangeType The RangeType class represents a type which represents a range of values.
RealType This is the base class for all scaled types such a C's float and double types.
RecordType A class representing a record or structure type.
RefType A RefType node is used to represent an exisiting type when attributes must be set on a new equivalent type.
SuperType This class represents a base class in the definition of a class.
Type This class is the root class for type nodes.
TypeTable This class maps from an integer value to a Type.
UnionType A class representing a C union type.
VoidType This class represents the void type in C and is used to represent the absence of a type.
 

Package scale.clef.type Description

Provides for describing the types of expressions and variables. The Type class is the base class for all types.

Most types in Scale are unique - that is, there is only one instance of a 32-bit signed integer type. Because they are unique, the == operator may be used to compare them.

Two types are not unique: RefType and IncompleteType. These two types contain links to the actual type. The RefType allows names and attributes to be attached to a type. For example, a structure name or the const attribute. The IncompleteType is used for forward referencing as in a structure that has a field of type pointer-to its own type.

All classes that that require type information such as expressions and declarations support two methods:

getType()
return the type of the object, and
getCoreType()
return the "core type" of the object.
The difference between these two methods is that getCoreType() returns the most basic type. That is, if the type is modified by a name or attribute, or if it was originally incomplete, getCoreType() accesses the un-modified base type. For example, for
  typedef int int32;
  const int32 x;
getCoreType() applied to the variable x would return the type instance for an int.

It is very important to use the correct method. For example, for

  typedef int int32a;
  const int32a x;
  typedef int int32b;
  const int32b y;
the types returned by getType for x and y would not be identical. However, the types returned by getCoreType would be identical.