Integer types | SHORTINT, INTEGER, LONGINT |
Real types | REAL, LONGREAL |
Numeric types | integer types, real types |
Two variables a and b with types Ta and Tb are of the same type if
Two types Ta and Tb are equal if
Numeric types include (the values of) smaller numeric types according to the following hierarchy LONGREAL REAL
LONGINT
INTEGER
SHORTINT
Given a type declaration Tb = RECORD (Ta)... END, Tb is a direct extension of Ta, and Ta is a direct base type of Tb. A type Tb is an extension of a type Ta (Ta is a base type of Tb) if
If Pa = POINTER TO Ta and Pb = POINTER TO Tb, Pb is an extension of Pa (Pa is a base type of Pb) if Tb is an extension of Ta.
An expression e of type Te is assignment compatible with a variable v of type Tv if one of the following conditions hold:
An actual parameter a of type Ta is array compatible with a formal parameter f of type Tf if
For a given operator, the types of its operands are expression compatible if they conform to the following table (which shows also the result type of the expression). Character arrays to be compared must contain 0X as a terminator. Type T1 must be an extension of type T0:
operator | first operand | second operand | result type |
+ - * | numeric | numeric | smallest numeric type including both operands |
/ | numeric | numeric | smallest real type including both operands |
+ - * / | SET | SET | SET |
DIV MOD | integer | integer | smallest integer type including both operands |
OR & ~ | BOOLEAN | BOOLEAN | BOOLEAN |
= # < <= > >= | numeric | numeric | BOOLEAN |
CHAR | CHAR | BOOLEAN | |
character array, string | character array, string | BOOLEAN | |
= # | BOOLEAN | BOOLEAN | BOOLEAN |
SET | SET | BOOLEAN | |
NIL, POINTER TO T0 or T1 | NIL, POINTER TO T0 or T1 | BOOLEAN | |
procedure type T, NIL | procedure type T, NIL | BOOLEAN | |
IN | integer | SET | BOOLEAN |
IS | pointer | pointer | BOOLEAN |
record | record | BOOLEAN |
Two formal parameter lists match if