2.1. Definitions

A program in the REXX language consists of clauses, which are
divided into four groups: null clauses, commands, assignments, and
instructions. The three latter groups (commands, assignments, and
instructions) are collectively referred to as statements. This
does not match the terminology in [TRL2], where “instruction” is
equivalent to what is known here as “statement”, and “keyword
instruction” is equivalent to what is known here as “instruction”.
However, I find the terminology used here simpler and less
confusing.

Incidentally, the terminology used here matches  [DANEY].

A clause is defined as all non-clause-delimiters (i.e. blanks and
tokens) up to and including a clause delimiter. A token delimiter
can be:

·    An end-of-line, unless it lies within a comment. An end-of-
  line within a constant string is considered a syntax error {6}.

·    A semicolon character that is not within a comment or
  constant string.

·    A colon character, provided that the sequence of tokens
  leading up to it consists of a single symbol and whitespace. If a
  sequence of two symbol tokens is followed by a colon, then this
  implies SYNTAX condition {13}.

Some systems have the ability to store a text file having a last
line unterminated by an end-of-line character sequence. In
general, this applies to systems that use an explicit end-of-line
character sequence to denote end-of-lines, e.g. Unix and MS-DOS
systems. Under these systems, if the last line is unterminated, it
will strictly speaking not be a clause, since a clause must
include its terminating clause delimiter.  However, some
interpreters are likely to regard the end-of-file as a clause
delimiter too. The functionality of INTERPRET gives some weight to
this interpretation. But other systems may ignore that last,
unterminated line, or maybe issue a syntax error. (However, there
is no SYNTAX condition number adequately covering this situation.

Example: Binary transferring files

Suppose a REXX program is stored on an MS-DOS machine. Then, an
end-of-line sequence is marked in the file as the two characters
carriage return and newline. If this file is transferred to a Unix
system, then only newline marks the end-of-line. For this to work,
the file must be transferred as a text file. If it is
(incorrectly) transferred as a binary file, the result is that on
the Unix system, each line seems to contain a trailing carriage
return character. In an editor, it might look like this:

      say ‘hello world’^M
      say ‘that”s it’^M

This will probably raise SYNTAX condition {13}.






PREV NEXT