HAL/S - Syntax

Syntax

HAL/S is a mostly free-form language: statements may begin anywhere on a line and may spill over the next lines, and multiple statements may be fit onto the same line if required. However, non-space characters in the first column of a program line may have special significance. For instance, the letter 'C' in the first column indicates that the whole line is a comment and should be ignored by the compiler.

One particularly interesting feature of HAL/S is that it supports, in addition to a normal single line text format, an optional three-line input format in which three source code lines are used for each statement. In this format, the first and third lines are usable for superscripts (exponents) and subscripts (indices). The multi-line format was designed to permit writing of HAL/S code that is similar to mathematical notation.

As an example, the statement could be written in single-line format as:

X = A ** 2 + B$(I) ** 2

Exponentiation is denoted by two asterisks, as in PL/I and Fortran. The subscript is denoted by a dollar sign,with the subscript expression enclosed in parentheses. The same code fragment could be written in multiple-line format as:

E 2 2 M X = A + B S I

In the example, the base line of the statement is indicated by an 'M' in the first column, the exponent line is indicated by an 'E', and the subscript line is indicated by an 'S'.

Read more about this topic:  HAL/S