Cind language documentation

Operators

List of operators in the Cind language:

operator arguments syntax changes argument description
++ 1 x++ yes increment x by 1, returns value before incrementation
++ 1 ++x yes increment x by 1, returns value after incrementation
-- 1 x-- yes decrement x by 1, returns value before decrementation
-- 1 --x yes decrement x by 1, returns value after decrementation
+ 2 x + y no addition
- 2 x - y no subtraction
* 2 x * y no multiplication
/ 2 x / y no divistion
% 2 x % y no modulo
! 1 !x no logical negation
~ 1 ~x no ones' complement
- 1 -x no unary negation
< 2 x < y no less than
<= 2 x <= y no less than or equal to
> 2 x > y no greater than
>= 2 x >= y no greater than or equal to
== 2 x == y no equal to
!= 2 x != y no not equal to
&& 2 x && y no logical and
|| 2 x || y no logical or
& 2 x & y no bitwise and
^ 2 x ^ y no bitwise xor
| 2 x | y no bitwise or
<< 2 x << y no bitwise left shift
>> 2 x >> y no bitwise right shift
?: 3 x ? y : z no ternary conditional
= 2 x = y yes assignment
+= 2 x += y yes assignment by sum
-= 2 x -= y yes assignment by difference
*= 2 x *= y yes assignment by product
/= 2 x /= y yes assignment by quotient
%= 2 x %= y yes assignment by remainder
&= 2 x &= y yes assignment by bitwise and
^= 2 x ^= y yes assignment by bitwise xor
|= 2 x |= y yes assignment by bitwise or
<<= 2 x <<= y yes assignment by bitwise left shift
>>= 2 x >>= y yes assignment by bitwise right shift


The column "changes argument" says if the first argument is changing during the operation.
For example, an expression z = x + y sets result of the sum in variable z but doesn't change variables x and y,
while expression z = ++x changes values in both variables z and x.

Operators && (logical and) and || (logical or) are evaluated in lazy way,
what means, that second argument will not be evaluated if the result of whole expression is already known from the value of first argument.

For priority of operators see Priority in expression.

Operations are not an atomic instructions.
For example, instruction ++(x[y]) may be executed in three steps: reading value x[y], increment value by calling operator ++, and finally writing the result back; while in the meantime other thread can change values in x, in y, and also in x[y].



Cind programming language 1.0.4

 

Advertisements