[Next] [Previous] [Top]

RTL Grammar

6 Unary and Binary Operators


These are the unary and binary operators currently defined.
unop_op namedescription
unary_-_intinteger negation
unary_-_floatfloat negation
unary_-_doubledouble negation
~_intbitwise complement
num_elems_intextract the number of elements of an array, vector, or string object.
box_intconvert an untagged machine integer into a tagged Cecil integer OOP
box_floatconvert an untagged machine float into a boxed, heap-allocated Cecil float OOP
box_doubleconvert an untagged machine double into a boxed, heap-allocated Cecil double OOP
box_charconvert an untagged machine integer into a boxed, heap-allocated Cecil char OOP
unbox_intinverse of box_int
unbox_floatinverse of box_float
unbox_doubleinverse of box_double
unbox_charinverse of box_char
map_ofreturns the CecilMap* pointer representing the run-time class of the argument;
used as the argument to inherits_from
binop_op namedescription
+_intAdd two signed integers
-_intSubtract ...
*_intMultiply ...
/_intDivide ...
%_intModulus ...
&_intBitwise and two integers
|_int... or ...
^_int... xor ...
xnor_int... xnor ...
<<_intbitwise left shift one integer by another
>>_int... arithmetic right shift ...
>>_logical_int... logical right shift ...
+_unsigned_intAdd two unsigned integers
-_unsigned_intSubtract ...
*_unsigned_intMultiply ...
/_unsigned_intDivide ...
%_unsigned_intModulus ...
&_unsigned_intBitwise and two unsigned integers
|_unsigned_int... or ...
^_unsigned_int... xor ...
xnor_unsigned_int... xnor ...
<<_unsigned_intbitwise left shift one unsigned integer by another
>>_unsigned_int... (logical) right shift ...
+_ptrAdd two values, one of which is assumed to be a pointer and the other an integer byte count, to produce a new pointer
-_ptrSubtract an integer byte count from a pointer to produce a new pointer
-_ptrdiffSubtract two pointers to produce an integer difference, in bytes
+_floatAdd two floats
-_floatSubtract ...
*_floatMultiply ...
/_floatDivide ...
+_doubleAdd two doubles
-_doubleSubtract ...
*_doubleMultiply ...
/_doubleDivide ...
=_int_logTest whether two integers are equal
!=_int_log... not equal
>_int_logTest whether one signed integer is greater than another
>=_int_log... greater than or equal to ...
<_int_log... less than ...
<=_int_log... less than or equal to ...
>_unsigned_logTest whether one unsigned integer is greater than another
>=_unsigned_log... greater than or equal to ...
<_unsigned_log... less than ...
<=_unsigned_log... less than or equal to ...
=_ptr_logTest whether two pointers are equal
!=_ptr_log... not equal
>_ptr_logTest whether one pointer is greater than another
>=_ptr_log... greater than or equal to ...
<_ptr_log... less than ...
<=_ptr_log... less than or equal to ...
=_float_logTest whether two floats are equal
!=_float_log... not equal
>_float_logTest whether one float is greater than another
>=_float_log... greater than or equal to ...
<_float_log... less than ...
<=_float_log... less than or equal to ...
=_double_logTest whether two doubles are equal
!=_double_log... not equal
>_double_logTest whether one double is greater than another
>=_double_log... greater than or equal to ...
<_double_log... less than ...
<=_double_log... less than or equal to ...
[Need to add int8 versions of these.]


RTL Grammar - 25 MARCH 1997
[Next] [Previous] [Top]

Generated with Harlequin WebMaker