Scripta expressions are always INTEGER but of course the result of
the evaluation of an expression may then be treated as INTEGER,
STRING or BOOLEAN, according to context.

BOOLEAN values in expressions always take the value 1 (TRUE) or 0
(FALSE). i.e., the expression 3=3 will reliably return the value 1,
rather than simply 'a non-zero value'.

Expressions may be composed of the following elements:

Variable names
~~~~~~~~~~~~~~
Any variable type may be used with the proviso that STRING
variables must contain a value which may be elaborated to an
INTEGER.

e.g., if the variable %fred currently has the value "123" then %fred
may be used in an expression to represent the value one hundred and
twenty three.

INTEGER literals
~~~~~~~~~~~~~~~~
 e.g., 23, -109, 100000, +33, etc.

An integer literal may optionally be terminated by a . (full stop)
character.

Comparators
~~~~~~~~~~~
 =   equal
 <   less than
 >   greater than
 <=  less than or equal to
 >=  greater than or equal to
 #   not equal
 <>  not equal

STRING functions
~~~~~~~~~~~~~~~~
These take the general form

            $fn(string1,string2)

where $fn may be any of the following:

$EQ - TRUE if string1 is identical to string2.
$NE - TRUE if string1 is NOT identical to string2.
$LT - TRUE if string1 is alphanumerically less than string2.
$GT - TRUE if string1 is alphanumerically greater than string2.
$GE - TRUE if string1 is alphanumerically >= string2.
$LE - TRUE if string1 is alphanumerically <= string2.

Within the above string functions, variable names used within
string1 and string2 may be qualified, in order to extract a
substring of the variable's value. For example, if the variable
%fred currently has the value "abcdefghij", the expression
%fred[3,4] could be used to represent the string "defg". i.e., the
substring of %fred which starts at position 3 and is 4 bytes long.

There is also the special function $LEN(string_value) which returns
the number of characters in string_value.

Example:        %a := "abcdef"
                %b := "ghijklm"
                If $eq(%a[2,1]x%b,"cxghijklm")
                   message "Yes"
                else
                   message "No"
                endif

The preceding short script would display the message "Yes".

Finally, the function $STATUS(%variable_name) may be used to obtain
the type of %variable_name.

$STATUS returns one of the following values, indicating the type of
the supplied variable name:

                    0 - unused
                    1 - string
                    2 - integer
                    3 - boolean
                    4 - file

Note that $STATUS may only be used in assignment statements. For
instance, the following is invalid:

             MESSAGE $STATUS(%somevar)

Operators
~~~~~~~~~
 -  minus (unary or binary)
 +  plus  (unary or binary)
 *  multiply
 /  divide (integer divide; remainder discarded)
 \  mod (i.e., remainder after integer division)
 ~  logical NOT
 &  logical AND
 |  logical OR

Brackets may be used and may be nested to an arbitrary level of
complexity.

In general, there is no operator precedence so operators will be
evaluated from left to right at the same bracket level. The
exception is that the unary operators have higher priority than
binary operators so the expression

             - %a + %b

will always be evaluated as (-%a) + %b

and never as  - (%a+%b)

Similarly, the expression

              ~ %a & %b

will always be evaluated as (~%a) & %b

and never as  ~(%a & %b)

Operators have higher priority than comparators so, for instance,
the expression

             %a = %b - %c

will be evaluated as %a = (%b - %c)

and never as  (%a = %b) - %c

Note that (%a = %b) - %c is a legal expression. The bracketed
element (%a = %b) will evaluate to 1 if %a and %b are equal and to
zero otherwise.

If in doubt, always use brackets to make clear what you mean (not
least to yourself).
