HP 3000 Manuals

Ch 7. Program Structure [ HP Pascal/iX Reference Manual ] MPE/iX 5.0 Documentation


HP Pascal/iX Reference Manual

Chapter 7  Program Structure 

An HP Pascal program consists of two major parts:  the program heading 
and the program block.  The program block includes the declaration part
which consists of definitions of constants and types, and declarations of
labels, variables, procedures, functions, and modules.  This chapter
describes in detail the program heading and program block.  This includes
the declaration part and module as well as the function and procedure.
Below is an example of an HP Pascal program.

Syntax 

     Compilation_unit:

[]
Example PROGRAM minimum; { The minimum program that the HP Pascal } BEGIN { compiler will process successfully: } END. { no program parameters. } PROGRAM show_form1 (output); { Uses the standard textfile output } BEGIN writeln ('Greetings!') { and the standard procedure writeln. } END. PROGRAM show_form2 (input,output); VAR a,b,total: integer; FUNCTION sum (i,j: integer): integer; { Function declaration } BEGIN sum:= i + j END; BEGIN prompt ('Enter two integers: '); readln (a,b); total:= sum (a,b); writeln ('The total is: ', total) END.


MPE/iX 5.0 Documentation