Type definitions

Description

Type identifiers are identifiers that have been associated with a type using a type definition. Type definitions must be placed in type definition groups.

Example

Here is an example of a type definition group:

type
   symbols = record
      name : string;
      value : integer;
   end;
   SymbolTable = list of symbols;
   color = (red, green, blue);
   cardinal = 0..maxint;
   IntegerList = array[1..100] of integer;
   characters = set of char;
   GenericObject = object;

Syntax

The syntax for type definition groups is given below:

(NOTE: for clarity some parts of the syntax are omitted, see Irie Pascal Grammar for the full syntax):

   type-definition-group = 'type' type-definition ';' { type-definition ';' }

   domain-type = type-identifier

   new-ordinal-type = enumerated-type | subrange-type

   new-pointer-type = '^' domain-type | '@' domain-type

   new-structured-type =
      [ 'packed' ] array-type |
      [ 'packed' ] record-type |
      [ 'packed' ] set-type |
      [ 'packed' ] file-type |
      [ 'packed' ] list-type |
                         object-type |
                         string-type

   new-type = new-ordinal-type | new-structured-type | new-pointer-type

   type-definition = identifier '=' type-denoter

   type-denoter = type-identifier | new-type

   type-identifier = identifier