Closed JSAbrahams closed 5 years ago
While implementing I noticed that operator precedence is not explicitly defined.
We need some tests for this and to update the documentation.
In cases where it does deviate from the precedence in Python, it should be clearly motivated I believe. For instance, and
and or
have higher precedence than comparison operators such as >
and <
. But why?
Eventually, in part due to conflicts with the current syntax, and the philosophy of Mamba, I opted to use:
_not_
for bitwise not, as opposed to ~
_and_
instead of &
_or_
instead of |
_xor_
instead of ^
Current Issue
There are no bitwise operators
Description of the feature
Add bitwise operators.
&
Bitwise AND|
Bitwise OR^
Bitwise XOR~
Binary ones complement<<
Binary left shift>>
Binary right shiftDescription of potential solution
Add tokens for these operators, and modify the pipeline accordingly. Since bitwise operators are a more advanced feature, I think that it's okay to let them be the same as in Python. So,
&
in Python is&
in Mamba,|
in Python|
in Mamba, etc.