Node:Source Structures, Next:Data Types, Up:Programming

### Source Structures

A source file accepted by GNU Pascal may contain up to one program, zero or more ISO-style modules, and/or zero or more UCSD-style units. Units and modules can be mixed in one project.

- The Program: The Source Structure of Programs
- Label Declaration:
- Constant Declaration:
- Type Declaration:
- Variable Declaration:
- Subroutine Declaration: Procedures, Functions and Operators
- Statements: Loops and Conditional Statements
- Modules and Units: Import Part and Module/Unit Concept

One trivial example for a valid GPC source file follows. Note that the code below may either be in one source file, or else the unit and the program may be in separate source files.

    unit DemoUnit;

    interface

    procedure Hello;

    implementation

    procedure Hello;
    begin
      WriteLn ('Hello, world!')
    end;

    end.

    program UnitDemo;

    uses
      DemoUnit;

    begin
      Hello
    end.