Contents | Prev | Next | Index


Array Types

An array is a structure consisting of a number of elements that are all of the same type, called the element type. The number of elements of an array type is called its length. The elements of the array are designated by indices, which are integers between 0 and the length-1.

array_type  ::= ARRAY length_list OF type
length_list ::= length_list , length
            ::= length
length      ::= const_expr 

A type of the form:

  ARRAY L0,L1,...Ln OF T

is understood as an abbreviation of

  ARRAY L0 OF
    ARRAY L1 OF
    ...
      ARRAY Ln OF T

Oberon-2 also allows arrays without the length specifier. These are called open arrays. They are restricted to base types of pointer types, to element types of open arrays, and to formal parameter types.

formal_type  ::= qualident
             ::= open_array qualident
pointer_type ::= POINTER TO type
             ::= POINTER TO open_array type
open_array   ::= open_array ARRAY OF
             ::= ARRAY OF 


Contents | Prev | Next | Index

Canterbury Oberon-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