Declarations:

 
<declaration statement> ::= DECLARE <declaration element>
		          | <declaration statement> , <declaration element> 

<declaration element>   ::= <type declaration>
                          | <identifier> LITERALLY <string>

<type declaration>      ::= <identifier specification> <type>
                          | <bound head> <number> ) <type>
                          | <type declaration> <initial list>

<type>                  ::= FIXED
                          | CHARACTER
                          | LABEL
                          | <bit head> <number> )

<bit head>              ::= BIT (

<bound head>            ::= <identifier specification> (

<identifier specification> ::= <identifier>
                             | <identifier list> <identifier> )

<identifier list>          ::= (
                             | <identifier list> <identifier> ,
 
<initial list>             ::= <initial head> <constant> )

<initial head>             ::= INITIAL (
                             | <initial head> <constant> ,
  
 
Declarations assign attributes to identifiers. All variables must be declared prior to use. The XPL program and any procedure definitions are called blocks. Procedure definitions may nest within the program block or other procedures to any depth. The scope of a declaration is the block where the declaration occurs and any nested blocks that do not contain another declaration for the same identifier.

XPL allows only one-dimensional arrays. All subscripts start at zero.

Initial values, specified by the initial attribute are set once at load-time and not at entry to the block containing the declaration.

The literally attribute is used to declare a simple parameterless macro. Any occurrence of the declared identifier following the declaration will be literally replaced during compilation by the character string following literally.

Example:


  declare n literally '5';
  declare arr(n)fixed;

Results in the declaration of arr as an array of five elements.