4.3. Array References

An array reference is restricted to a one or two dimensional set of numbers all of the same type (including scale for fixed-point). An array is represented by an identifier, suitably declared with, for each dimension, a lower and upper index bound in the form of a pair of integer constants, e.g.

FIXED(13,5) ARRAY b[0:19];
FLOATING ARRAY c[1:3,1:3];

The lower bound must never exceed the corresponding upper bound. If more than one array is required with the same numeric type, and the same dimensions and bounds, a list of array identifiers separated by commas may replace the single identifiers shown in the above examples. Arrays with the same numeric type but different bounds or dimensions may also be included in a composite declaration as shown below.

INTEGER ARRAY p, q, r[1:3], s[1:4], t, u[1:2, 1:3];

An array identifier refers to an array in its entirety, but its use in statements is confined to the communication of array references to a procedure. Elsewhere, an array identifier must be indexed so that it refers to a single array element. The index, in the form of an arithmetic expression enclosed in square brackets after the array identifier, is evaluated to an integer as described in Section 6.1.3. The syntax rules for array declaration, which include a presetting facility (Section 4.6.1), are:

Arraydec ::= 
     Numbertype  ARRAY  Arraylist  Presetlist 

Arraylist ::= 
     Arrayitem ,  Arraylist 

Arrayitem ::= 
     Idlist [  Sizelist ] 

Sizelist ::= 
     Dimension ,  Dimension 

Dimension ::= 
     Lowerbound :  Upperbound 

Lowerbound ::= 

Upperbound ::=