[fpc-pascal] Pascal grammar: Program heading can include parameters

Graeme Geldenhuys graemeg.lists at gmail.com
Thu Jul 1 12:02:38 CEST 2010


I'm busy writing a Object Pascal grammar section for the Language Reference

In the ref.pdf (page 144) it says that the PROGRAM line can contain
'program parameters', but is ignored by the compiler. Can anybody explain
these "program parameters" and when and how they were actually used? I'm
just curious. This obviously stems from the original Pascal days.

Looking in the Kylix 3 Language Reference doc (page 3-2) it also mentions
the program parameters and also mentions that the compiler ignores those
parameters. :-/

Syntax is as follows:

  Program -> PROGRAM Ident ['(' IdentList ')'] ';'
             ProgramBlock '.'

Here is an actual implementation, and it compiles fine with FPC 2.4.x, but
you can't do anything with those parameters.
---------[ test.pas ]------------------
program Test (param1, param2, param3, param4);

{$mode objfpc}{$H}

  Classes, SysUtils;

  writeln('hello world');
--------------[ end ]------------------

  - Graeme -

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal

More information about the fpc-pascal mailing list