Product SiteDocumentation Site

1.11. Terms, Expressions, and Operators

Expressions in Rexx are a general mechanism for combining one or more pieces of data in various ways to produce a result, usually different from the original data. All expressions evaluate to objects.
Everything in Rexx is an object. Rexx provides some objects, which are described in later sections. You can also define and create objects that are useful in particular applications—for example, a menu object for user interaction. See Section 1.3, “Modeling Objects” for more information.

1.11.1. Terms and Expressions

Terms are literal strings, symbols, message terms, function calls, or subexpressions interspersed with zero or more operators that denote operations to be carried out on terms.
Literal strings, which are delimited by quotation marks, are constants.
Symbols (no quotation marks) are translated to uppercase. A symbol that does not begin with a digit or a period can be the name of a variable; in this case the value of that variable is used. A symbol that begins with a period can identify an object that the current environment provides; in this case, that object is used. Otherwise a symbol is treated as a constant string. A symbol can also be compound.
Message terms are described in Section 1.11.4, “Message Terms”.
Function calls (see Chapter 7, Functions), which are of the following form:

                    +-,--------------+
                    V                |
>>-symbolorstring(----+------------+-+--)----------------------><
                      +-expression-+

The symbolorstring is a symbol or literal string.
An expression consists of one or more terms. A subexpression is a term in an expression surrounded with a left and a right parenthesis.
Evaluation of an expression is left to right, modified by parentheses and operator precedence in the usual algebraic manner (see Section 1.11.3, “Parentheses and Operator Precedence”). Expressions are wholly evaluated, unless an error occurs during evaluation.
As each term is used in an expression, it is evaluated as appropriate. The result is an object. Consequently, the result of evaluating any expression is itself an object (such as a character string).