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 and records, it also defines the structure of variables of this type. Non-structured types are basic 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. 

type_decl   ::= identdef = type
type        ::= simple_type
            ::= array_type
            ::= record_type
            ::= pointer_type
            ::= procedure_type
simple_type ::= qualident

Examples:

  Table = ARRAY N OF REAL

  Tree = POINTER TO Node

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

  CenterTree = POINTER TO CenterNode

  CenterNode = RECORD( Node )
    width : INTEGER;
    subnode : Tree;
  END

  Function = PROCEDURE( x : INTEGER ) : INTEGER


Contents | Prev | Next | Index

Canterbury Oberon-2 for JVM  (Last documentation update Jun 2, 2000)
Copyright © 1998 Mill Hill & Canterbury Corporation, Ltd. All rights reserved
Please send any comments or corrections to mhc@webcom.com