Next: , Previous: Procedural Language Interpreter Usage Outline, Up: Procedural Language Interpreter


5.2 Procedural Language Syntax

The procedural language syntax much resembles the C syntax. And the imperative language syntax to which it only adds functions.

See Imperative Language Syntax.

Functions are introduced much like in C: type, name, parentheses surrounded and comma separated arguments, braces surrounded body. The syntax for function bodies is the one of the imperative language.

Function forward declarations are not supported.

The formal syntax definition is:

program: function subsequent_function

function: type name `(' arguments_list `)' `{' block `}'

arguments_list: `void'
    | variables_list

variables_list: variable subsequent_variable

variable: type reference_class name

reference_class:
    | `&'

subsequent_variable: `,' variable

subsequent_function:
    | function subsequent_function

The `block' syntax is same as for the imperative language syntax.

Functions may only return no value (`void') or data of intrinsic integer or real type (`mode' and `real').

See Intrinsic Types.

One `main' function, returning intrinsic integer data and having an empty arguments list, is expected.

Pass by reference is supported and introduced via the `&' literal.