Open brice-morin opened 6 years ago
Just for reference, here are the binary operators that are defined in Java, C, JavaScript and Go:
&
binary AND|
binary OR^
binary XOR<<
binary shift left>>
binary shift rightI can see two possible conflicts with the ThingML syntax, namely the &
and ^
.
&
which is used in the extern segments. So an expression like:
`extern_var` & var
Could mean both an extern with two segments, or the binary and
^
is used for escaping names in ThingML. So that you can give names that are the same as keywords. So I think this might cause problems for the parser as well.
Well, do we really need this escape mechanism in ThingML? If so, I guess we can change the symbol.
For the &
, I see the problem.
In addition:
~
is supported in all languages (see doc for Java) but Go, and we actually use it in some places...That is particularly annoying, meaning that the externs we write so as to deal with those operators are actually not as portable as we thought... i.e. we need, more than ever, to have them in the action language.
@ffleurey comments?
A few ThingML programs use bit/byte operators and have to rely on extern expressions, which by chance are the same in all the languages we target so far. Still, this is a hack, not allowing for proper type-checking, etc. We would need to introduce those operators (shift left/righ, bit-wise and, or, xor) in the action language.