Procedure declarations

Description

Procedure identifiers are identifiers that have been associated with a procedure using a procedure declaration.

Example

Here is an example of a procedure declaration.

   (*******************************************************************
   ** PURPOSE: Writes the contents of one file into another.
   ** ARGUMENTS:
   **    'f' - the input file
   **    'g' - the output file
   ** NOTES: It is up to the caller to open and close the files.
   *)
   procedure WriteFile(var f, g : text);
   var
      c : char;
   begin
      while not eof(f) do
         begin
            read(f, c);
            write(g, c)
         end
   end;

Syntax

(NOTE: for clarity some parts of the syntax are omitted, see Irie Pascal Grammar for the full syntax):

   procedure-declaration =
       procedure-heading ';' directive |
       procedure-identification ';' procedure-block |
       procedure-heading ';' procedure-block

   block = declarative-part statement-part

   compound-statement = 'begin' statement-sequence 'end'

   declaration-group =
             label-declaration-group |
             constant-definition-group |
             type-definition-group |
             variable-declaration-group |
             function-declaration  | 
             procedure-declaration

   declarative-part = { declaration-group }

   directive = forward-directive | external-directive

   formal-parameter-list = '(' formal-parameter-section { ';' formal-parameter-section } ')'

   formal-parameter-section = value-parameter-specification |
                  variable-parameter-specification |
                  procedure-parameter-specification |
                  function-parameter-specification

   function-heading = 'function' identifier [ formal-parameter-list ] ':' result-type

   function-identification = 'function' function-identifier

   function-identifier = identifier

   function-parameter-specification = function-heading

   identifier = letter { letter | digit }

   identifier-list = identifier { ',' identifier }

   procedure-block = block

   procedure-heading = 'procedure' identifier [ formal-parameter-list ]

   procedure-identification = 'procedure' procedure-identifier

   procedure-identifier = identifier

   procedure-parameter-specification = procedure-heading

   statement-part = compound-statement

   statement-sequence = statement { ';' statement }

   type-identifier = identifier

   value-parameter-specification = identifier-list ':' type-identifier

   variable-parameter-specification = 'var' identifier-list ':' type-identifier