[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
A generic GNU Pascal program looks like the following:
program name (Input, Output); |
The program
headline may be omitted in GPC, but a warning
will be given except in `--borland-pascal' mode.
While the program parameters (usually `Input', `Output') are obligatory in ISO Pascal if you want to use `ReadLn' and `WriteLn', they are optional in GNU Pascal. GPC will warn about such missing parameters in `--extended-pascal' mode. However if you give parameters to the program headline, they work like ISO requires.
The import part consists either of an ISO-style `import' specification or a UCSD/Borland-style `uses' clause. While `import' is intended to be used with interfaces exported by ISO-10206 Extended Pascal modules, and `uses' is intended to be used with units, this is not enforced. (See also section 9.293 uses, section 9.113 import.)
The declaration part consists of label, constant, type, variable or subroutine declarations in free order. However, every identifier must be declared before it is used. The only exception are type identifiers pointing to another type identifier which may be declared below.
The statement part consists of a sequence of statements.
As an extension, GPC supports a "declaring statement" which can be used in the statement part to declare variables (see section 9.296 var).