Declaration Part [ HP Pascal/iX Reference Manual ] MPE/iX 5.0 Documentation
HP Pascal/iX Reference Manual
Declaration Part
The declaration part consists of definitions of constants and types, and
declarations of labels, variables, procedures, functions, and modules.
The statement part is made up of a compound statement that may be empty
or may contain several simple or structured statements. The statement
part is also termed the body or executable portion of the block. For
more information about statements, refer to Chapter 6 .
The reserved word LABEL precedes the declaration of labels. CONST or
TYPE precedes the definition of declared constants or types. VAR
precedes the declaration of variables. IMPORT precedes a list of
imported module names. MODULE precedes the declaration of a module.
PROCEDURE or FUNCTION precedes the declaration of a procedure or a
function.
Within a declaration part, label declarations must come first, whereas
procedure or function declarations come last. In HP Pascal, CONST, TYPE,
IMPORT, VAR, and MODULE declarations may be intermixed and repeated. For
more information on declarations, refer to Chapter 5 .
NOTE ANSI/IEEE770X3.97 - 1983 Standard Pascal allows the following
reserved words, LABEL, CONST, TYPE, or VAR to be used only once in
that order.
A predefined constant, type, variable, procedure, or function may be
redeclared in a declaration part. However, access to the previous
definition associated with that item is lost within the scope in which it
is redefined.
Example
PROGRAM show_declarepart;
LABEL 25;
VAR
birthday: integer;
TYPE
friends = (Joe, Simon, Leslie, Jill);
CONST
maxnuminvitee = 3;
VAR
invitee: friends;
PROCEDURE hello;
BEGIN
writeln('Hi');
END; { End of declaration part. }
BEGIN { Beginning of body. }
.
.
END.
MPE/iX 5.0 Documentation