Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
HP Pascal/HP-UX Programmer's Guide > Chapter 2 Program Structure

Syntactic Structure

» 

Technical documentation

Complete book in PDF
» Feedback
Content starts here

 » Table of Contents

 » Glossary

 » Index

Syntactically, every HP Pascal program is composed of two major parts: the program heading and the program block. The program block contains an optional declaration part and a statement (executable) part.

Figure 2-1 “Syntactic Structure of a Program ” illustrates the syntactic structure of an HP Pascal program. For the exact syntax of a program and its components, refer to the HP Pascal/iX Reference Manual or the HP Pascal/HP-UX Reference Manual, depending on your implementation.

Figure 2-1 Syntactic Structure of a Program

Syntactic Structure of a Program

Program Heading

The program heading contains the keyword PROGRAM, the program name, and any program parameters. The program name can be any identifier. If your program uses the standard textfiles input and output (the default sequential I/O files), these textfiles must be program parameters.

Program parameters — except the standard textfiles input, output, and stderr — must also be declared in the declaration part of the program block.

Example

See the example in the section “Program Block ”.

For more information about program parameters, see Appendix A “MPE/iX Dependencies ” and Appendix B “HP-UX Dependencies ”.

Program Block

The program block consists of an optional declaration part and a statement (executable) part.

The declaration part defines whatever labels, constants, data types, variables (including program parameters), procedures, functions, or modules you want. It can also redefine standard constants, data types, variables, and routines in the declaration part; however, if you do redefine them, you cannot use their original definitions. You cannot redefine reserved words. For a list of HP Pascal reserved words, refer to the HP Pascal/iX Reference Manual or the HP Pascal/HP-UX Reference Manual, depending on your implementation.

The statement part is a compound statement (for the definition of compound statement, see the HP Pascal/iX Reference Manual or the HP Pascal/HP-UX Reference Manual, depending on your implementation).

Figure 2-2 Program Block Example

Program Block Example
Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© Hewlett-Packard Development Company, L.P.