Clauses and Instructions

Clauses can be subdivided into the following types:

Null Clauses

A clause consisting only of blanks, comments, or both is a null clause. It is completely ignored.

Note: A null clause is not an instruction; for example, putting an extra semicolon after the THEN or ELSE in an IF instruction is not equivalent to using a dummy instruction (as it would be in the C language). The NOP instruction is provided for this purpose.

Directives

A clause that begins with two colons is a directive. Directives are nonexecutable code and can start in any column. They divide a program into separate executable units (methods and routines) and supply information about the program or its executable units. Directives perform various functions, such as associating methods with a particular class (::CLASS directive) or defining a method (::METHOD directive). See Directives for more information about directives.

Labels

A clause that consists of a single symbol or string followed by a colon is a label. The colon in this context implies a semicolon (clause separator), so no semicolon is required.

The label's name is taken from the string or symbol part of the label. If the label uses a symbol for the name, the label's name is in uppercase. If a label uses a string, the name can contain mixed-case characters.

Labels identify the targets of CALL instructions, SIGNAL instructions, and internal function calls. Label searches for CALL, SIGNAL, and internal function calls are case-sensitive. Label-search targets specified as symbols cannot match labels with lowercase characters. Literal-string or computed-label searches can locate labels with lowercase characters. More than one label can precede an instruction. Labels are treated as null clauses and can be traced selectively to aid debugging.

Labels can be any number of successive clauses. Several labels can precede other clauses. Duplicate labels are permitted, but control is only passed to the first of any duplicates in a program. The duplicate labels occurring later can be traced but cannot be used as a target of a CALL, SIGNAL, or function invocation.

Instructions

An instruction consists of one or more clauses describing some course of action for the language processor to take. Instructions can be assignments, message instructions, keyword instructions, or commands.

Assignments

A single clause of the form symbol=expression is an instruction known as an assignment. An assignment gives a (new) value to a variable. See Assignments and Symbols.

Extended Assignments

The character sequences +=, -=, *= /=, %=, //=, ||=, &=, |=, and &&= can be used to create extended assignments. These sequences combine an operation with the assignment. See Extended Assignments for more details.

Message Instructions

A message instruction is a single clause in the form of a message term (see Message Terms) or in the form messageterm=expression. A message is sent to an object, which responds by performing some action. See Message Instructions.

Keyword Instructions

A keyword instruction is one or more clauses, the first of which starts with a keyword that identifies the instruction. Keyword instructions control, for example, the external interfaces and the flow of control. Some keyword instructions can include nested instructions. In the following example, the DO construct (DO, the group of instructions that follow it, and its associated END keyword) is considered a single keyword instruction.

DO
  instruction
  instruction
  instruction
END

A subkeyword is a keyword that is reserved within the context of a particular instruction, for example, the symbols TO and WHILE in the DO instruction.

Commands

A command is a clause consisting of an expression only. The expression is evaluated and the result is passed as a command string to an external environment.