Contents | Prev | Next | Index
A data type determines the set of values that variables of that type may assume, and the operators that are applicable. A type declaration associates an identifier with a type. If it is a structured type, such as arrays, records, and sets, it also defines the structure of variables of this type. Non-structured types are basic types, enumerations, subrange types, pointer types, and procedure types. A type declaration can also refer to a simple type which is a (possibly qualified) identifier of another already existing type, or an enumeration or a subrange type.
type_decl ::= <identifier> = type type ::= simple_type ::= array_type ::= record_type ::= pointer_type ::= procedure_type simple_type ::= qualident ::= enumeration ::= subrange_type |
Examples:
Table = ARRAY [0..N-1] OF REAL
Tree = POINTER TO Node
Node = RECORD
key : INTEGER;
left, right : Tree
END
CenterTree = POINTER TO CenterNode
(* extended Modula-2 language only: *)
CenterNode = RECORD( Node )
width : INTEGER;
subnode : Tree;
END
Function = PROCEDURE( INTEGER ) : INTEGER
Contents | Prev | Next | Index
Canterbury Modula-2 for Java (Last documentation update
Feb 8, 2000)
Copyright © 1998 Mill Hill &
Canterbury Corporation, Ltd. All rights reserved
Please send any comments or corrections to
mhc@webcom.com