Last updated: Jan 17, 2024
This page lists the available CLEM language operators.
Operation | Comments | Precedence (see next section) |
---|---|---|
or
|
Used between two CLEM expressions. Returns a value of true if either is true or if both are true. | 10 |
and
|
Used between two CLEM expressions. Returns a value of true if both are true. | 9 |
=
|
Used between any two comparable items. Returns true if ITEM1 is equal to ITEM2. | 7 |
==
|
Identical to = . |
7 |
/=
|
Used between any two comparable items. Returns true if ITEM1 is not equal to ITEM2. | 7 |
/==
|
Identical to /= . |
7 |
>
|
Used between any two comparable items. Returns true if ITEM1 is strictly greater than ITEM2. | 6 |
>=
|
Used between any two comparable items. Returns true if ITEM1 is greater than or equal to ITEM2. | 6 |
<
|
Used between any two comparable items. Returns true if ITEM1 is strictly less than ITEM2 | 6 |
<=
|
Used between any two comparable items. Returns true if ITEM1 is less than or equal to ITEM2. | 6 |
&&=_0
|
Used between two integers. Equivalent to the Boolean expression INT1 && INT2 = 0. | 6 |
&&/=_0
|
Used between two integers. Equivalent to the Boolean expression INT1 && INT2 /= 0. | 6 |
+
|
Adds two numbers: NUM1 + NUM2. | 5 |
><
|
Concatenates two strings; for example,
STRING1 >< STRING2 . |
5 |
-
|
Subtracts one number from another: NUM1 - NUM2. Can also be used in front of a number: - NUM. | 5 |
*
|
Used to multiply two numbers: NUM1 * NUM2. | 4 |
&&
|
Used between two integers. The result is the bitwise 'and' of the integers INT1 and INT2. | 4 |
&&~~
|
Used between two integers. The result is the bitwise 'and' of INT1 and the bitwise complement of INT2. | 4 |
||
|
Used between two integers. The result is the bitwise 'inclusive or' of INT1 and INT2. | 4 |
~~
|
Used in front of an integer. Produces the bitwise complement of INT. | 4 |
||/&
|
Used between two integers. The result is the bitwise 'exclusive or' of INT1 and INT2. | 4 |
INT1 << N
|
Used between two integers. Produces the bit pattern of INT shifted left by N positions. | 4 |
INT1 >> N
|
Used between two integers. Produces the bit pattern of INT shifted right by N positions. | 4 |
/
|
Used to divide one number by another: NUM1 / NUM2. | 4 |
**
|
Used between two numbers: BASE ** POWER. Returns BASE raised to the power POWER. | 3 |
rem
|
Used between two integers: INT1 rem INT2. Returns the remainder, INT1 - (INT1 div INT2) * INT2. | 2 |
div
|
Used between two integers: INT1 div INT2. Performs integer division. | 2 |
Operator precedence
Precedences determine the parsing of complex expressions, especially unbracketed expressions with more than one infix operator. For example,
3 + 4 * 5
parses as 3 + (4 * 5)
rather than (3 + 4) *
5
because the relative precedences dictate that *
is to be parsed before
+
. Every operator in the CLEM language has a precedence value associated with it;
the smaller this value, the more important it is on the parsing list, meaning that it will be
processed sooner than other operators with larger precedence values.