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).
AllocArrayType This class represents array types with bounds that are determined at run time.
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 integer values.
CharacterType This class represents the character type for languages other than C.
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.
FloatType This class repsents floating point types such as C's float and double types.
FortranCharType The FortranCharType class represents the Fortran CHARACTER type.
IncompleteType An IncompleteType is used to represent a type before the complete type is known.
IntegerType The IntegerType class represents a primitive integer type.
NumericType This is the base class for all numeric types.
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 Un-used.
RaiseWithType Un-used.
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.
SignedIntegerType The SignedIntegerType class represents a primitive signed integer type.
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.
UnsignedIntegerType The UnsignedIntegerType class represents a primitive unsigned integer type.
VoidType This class represents the void type in C and is used to represent the absence of a type.
 

Enum Summary
RefAttr This enum specifies the attributes of a reference type - const, aligned, etc.
 

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.