
132
Chapter 8
Operation Comments Precedence (se
e next section)
&&
Used between two integers. The re sult
is the bitwise ‘and’ of the in t egers IN T1
and INT2.
4
&&~~
Used between two integers. The re sult
is the bitwise ‘and’ of INT1 and the
bitwise complement of INT2.
4
||
Used between two integers. The re sult
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 re sult
is the bi t wi se ‘exclusive or’ of INT1
and INT2.
4
INT1 << N
Used between two integers. Produ ces
the bit pattern of INT shifted left by N
positions.
4
INT1 >> N
Used between two integers. Produ ces
the bit pattern of INT shifted right by
N positions.
4
/
Used to divide one number by another:
NUM1 / N U M
2.
4
**
Used between two numb ers : BA SE **
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 dete r mine the parsing of complex exp r essions, 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 pr ecedences dictate that * is to be
parsed befo r e +. Every operator in the CLEM language has a precedence value associated with it;
the lower this value, the more important it is on the parsing list, meaning that it will be processed
sooner than other operators with higher precedence values.
Commenti su questo manuale