Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2010-07

Pascal grammar: Program heading can include parameters

4 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Graeme Geldenhuys

Hi,

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

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.
eg:
---------[ test.pas ]------------------
program Test (param1, param2, param3, param4);

{$mode objfpc}{$H}
uses
  Classes, SysUtils;
begin
  writeln('hello world');
end.
--------------[ end ]------------------

Regards,
- Graeme -

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://opensoft.homeip.net/fpgui/
Marco van de Voort
to Graeme Geldenhuys

In our previous episode, Graeme Geldenhuys said:

Show quoted text 7 lines
I'm busy writing a Object Pascal grammar section for the Language Reference doc. 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.

In original pascal you had to specify all opened files there, including input/output.

This was used by some OSes for their file I/O (e.g. VMS, where afaik the shell allocates memory and handles for open files). There was also some functionality for unnamed files (temporary ones).

If you want details, talk to the GPC people, read their docs (or Scott Moore's site)

But usually there were assign() like non standarized workarounds to open files later than at program start.

Syntax is as follows: Program -> PROGRAM Ident ['(' IdentList ')'] ';' ProgramBlock '.'

Strange. Where are the modifiers (deprecated etc)? Or where unit level modifiers post D7 ?

Graeme Geldenhuys
to Marco van de Voort

Op 2010-07-01 12:14, Marco van de Voort het geskryf:

In original pascal you had to specify all opened files there, including input/output.

Thanks for that history. :)

Show quoted text 7 lines
> Syntax is as follows: > > Program -> PROGRAM Ident ['(' IdentList ')'] ';' > ProgramBlock '.' Strange. Where are the modifiers (deprecated etc)? Or where unit level modifiers post D7 ?

As far as I know modifiers are not allowed in a Program unit, only in a Unit unit. FPC's ref.pdf and Kylix 3 lang ref doc seem to confirm this.

Here is the grammar for a UNIT.

Unit -> UNIT Ident [PortabilityDirective] ';'
InterfaceSection
ImplementationSection
InitSection '.'

...

PortabilityDirective -> platform
-> deprecated
-> library

Regards,
- Graeme -

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://opensoft.homeip.net/fpgui/
Bart
to Marco van de Voort: In our previous episode, Graeme Geldenhuys said: In original pascal you had to specify…
Marco van de Voort wrote
In original pascal you had to specify all opened files there, including input/output.

That is how I learned it (from a book about standard(?) pascal). I remember having several programs with long lists of files, before I discovered that this was not necessary in TP3 ;-)
(My TP3 had written documentation in Arabic, which didn't help me all that much)

Bart