Article Directory
Type expression
basic type
- The basic type is the type of expression
- integer
- real
- char
- boolean
- a type_error (type error)
- void (untyped)
Can name the type of expression, the type name is the type of expression, the type constructor applied to type expression can constitute a new type of expression
Type constructor
Array constructor
If T is the type of expression, array(I,T)
it is a type expression (I is an integer)
E.g:
Pointer constructor
If T is a type expression, it pointer(T)
is the type of expression, it represents a pointer type.
Cartesian product constructor$✖$
If $T_1$
and $T_2$
is the type of expression, the Cartesian product $T_1*T_2$
is a type expression
Constructor function$\rightarrow$
If Tong $T_1$
, , $T_2$
..., $T_n$
and R
all types of expression, $T_1*T_2*...*T_n\rightarrow{R}$
is the type of expression
$T_1$
Where, $T_2$
, , ..., $T_n$
as function parameters, R
return value
Record constructor
If identifier $N_1$
, $N_2$
, ..., $N_n$
and the type of expression $T_1$
, $T_2$
, ..., $T_n$
is $record((N_1*T_1) * (N_2*T_2) *...* (N_n*T_n))$
a type expression.
E.g: