The WESCL program consists of instructions. Every instruction has an expression and an action part. The first one is ended by a colon and the second one is ended by a semicolon. The instruction syntax looks as follows:
expression : action ; |
An expression is any valid set of values, variables, operators, and expressions that evaluate to a single integer value. In every expression WESCL allows to use:
Values: true, false, -32768..32767
Variables: I0..I99, O0..O99, D0..D19, B0..B99, M0..M99, S0..S99, C0..C99
Operators: (), &&, ||, !, - (unary), *, /, %, +, -, >, <, >=, <=, !=, ==
Example 2-1. Expression examples
true I5 && D0 M4 * (2 + !B99) |
Conceptually, there are two types of actions: those that assign a value of expression to a variable (assignment action type), and those that simply represent a variable name (variable name action type).
One can use one of the following register identifiers as a variable: I0..I99, O0..O99, D0..D19, B0..B99, M0..M99, S0..S99, C0..C99.
Example 2-2. Assignment action type
O1 = I1 M5 = D0 * 2 B0 = M4 * (2 + !B99) |
Example 2-3. A variable name action type
B0 -M0 I3 !I3 |
Additionally, any actions can be grouped in multi-actions using the comma operator.
Example 2-4. Multi action examples
/* assignment actions */ O1 = I1, M5 = D0 * 2, B0 = M4 * (2 + !B99) B4, M0 O1 = I1, M5 = D0 * 2, B0 = M4 * (2 + !B99), B4, M0 |
WESCL supports also action that can make assignment of string or copy string from one string-holder variable to another.
Example 2-5. String actions examples
A0 = "Hello!" A1 = A0 V = "index.html" A2 = "" |