Previous Next Chapter

( Clauses

:) Colon

A colon defines a label when preceded by a symbol token (may alphanumeric character or . ! ? $).

( ) Parentheses

Parentheses are used to group operators and operands into subexpressions to override the normal operator priorities. An open parenthesis also serves to identify a function call within an expression. A Symbol or string followed immediately by an open parenthesis defines a function name. Parentheses must always be balanced within a statement.

(;) Semicolon

A semicolon acts as a statement terminator. Statements too long to fit on one line may be separated by semicolons.

(,) Comma

A comma acts as the continuation character for statements broken into several lines and as a separator of argument expressions in a function call.

Clauses, the smallest language unit that can be executed as a statement, are formed from token groupings.

As the program is read, the language interpreter splits the program into groups of clauses. These group of one or more clauses are then broken down into tokens and each clause is classified as a particular type. Seemingly small syntactic differences may completely change the semantic content of a statement. For example:

SAY `Hello, Bill'

is an instruction clause and will display "Hello, Bill" on the console, but:

` `SAY `Hello, Bill'

is a command clause, and will issue "SAY Hello, Bill" as a command to an external program. The presence of the leading null string (` `) changes the classification from an instruction clause to a command clause.

The end of a line normally acts as the implicit end of a clause. A clause can be continued on the next line by ending the line with a comma. The comma is ignored by the program, and the next line is considered as a continuation of the clause. There is no limit to the number of continuations that may occur (except for those limits imposed by the command buffer).

String and comment tokens are automatically continued if a line ends before the closing delimiter has been found, and the newline (i.e., enter) character is not considered to be part of the token.

Null Clauses

Null clauses are lines of blanks or comments and may appear anywhere in a program. They have no function in the execution of a program, except to aid its readability and to increment the line count.

Label Clauses

A label clause is a symbol followed by a colon (:). A label acts as a place marker in the program, but no action occurs with the execution of a label. The colon is considered as an implicit clause terminator, so each label stands as a separate clause. Label clauses may appear anywhere in a program. For example:

start: /*Begin execution*/
syntax: /*Error processing*/

Assignment Clauses

Assignment clauses are identified by a variable symbol followed by an = operator. (In this context the = operator's normal definition of equality comparison is overridden.) The tokens to the right of the = are evaluated as an expression and the result is assigned to the variable. For example:

When = `Now is the time'
answ = 3.14 * fact (5)

The equal sign (=) assigns the value `Now is the time' to the variable `when', and assigns the result of 3.14 * fact(5) to the variable `answ'.

Instruction Clauses

Instruction clauses begin with the name of the instruction and tell ARexx to perform an action. Instruction names are described in Chapter 4. For example:

DROP a b c
SAY `please'
IF j > 5 THEN LEAVE;

Command Clauses

Command clauses are any ARexx expression that cannot be classified as one of the preceding types of clauses. The expression is evaluated and the result is issued as a command to an external host. For example:

`delete' `myfile' /*AmigaDOS command*/
`jump' current+10 /*An editor command*/

The delete command is not recognized as an ARexx command, so it is sent to the external host, in this case AmigaDOS. The jump command in the second example is assumedly understood by an external text editor.

Top Previous Next Chapter