Set types


Set types define values which specify whether individual elements (known not suprisingly as set elements) are present or not. The group of possible set elements of a particular set type form an ordinal type, known as the set's base type. Set values do not specify whether set elements are present in any partucular order, and set elements can not be present more than once. All set types define the empty set (i.e. the set value specifying that none of the set elements are present).

For example the following set type

   set of boolean

defines four values

  1. [] - neither false nor true are present.
  2. [false] - false is present but not true
  3. [true] - true is present but not false
  4. [false, true] - both false and true are present.
Irie Pascal uses two different representations for values of set types depending on the range of the set's base type. For example suppose you have the following set type:

   set of T

then if T's range is less than or equal to 256 then the set is represented as a bit set, otherwise the set is represented using an array representation of fixed size.


Here are some examples of set types

   set of char
   set of boolean


The syntax for defining new set types is given below:

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

   set-type = 'set' 'of' base-type

   base-type = ordinal-type

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

   ordinal-type = new-ordinal-type | ordinal-type-identifier

   ordinal-type-identifier = identifier