Contents | Prev | Next | Index


Type Declarations

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, sets, file types, classes and class references, 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. Finally, a type declaration can also introduce a string type.

type_decl       ::= <identifier> = type
type            ::= simple_type
                ::= string_type
                ::= pointer_type
                ::= procedure_type
                ::= structured_type
                ::= PACKED structured_type
simple_type     ::= qualident
                ::= enumeration
                ::= subrange_type
structured_type ::= array_type
                ::= record_type
                ::= set_type
                ::= file_type
                ::= class_type
                ::= class_ref_type

Examples:

  Table = ARRAY [0..N-1] OF REAL

  Tree = ^Node

  Node = RECORD
    key : INTEGER;
    left, right : Tree
  END

  CenterTree = ^CenterNode

  CenterNode = RECORD
    basic : Node;
    width : INTEGER;
    subnode : Tree;
  END

  Func = FUNCTION( i : INTEGER ) : INTEGER


Contents | Prev | Next | Index

Canterbury Pascal for JVM  (Last documentation update Sep 02, 2004)
Copyright © 1999-2004 J.Neuhoff - mhccorp.com  . All rights reserved.
Please send any comments or corrections to neuhoff@mhccorp.com