What should Atalan use as binary operators

11 views
Skip to first unread message

rudla

unread,
Nov 27, 2010, 9:58:58 AM11/27/10
to Atalan Programming Langugage
Atalan currently uses AND and OR for both logical and binary
operators.

This however does not work very well in conditions.

if a = 5 and 7 then ...

should be binary operator but

if a = 5 and 7 = b then ....

should be logical operator.

This however does not parse well. It is necessary to rename binary
operators to something else.

XOR will probably remain same.

We can use C-like operators &, |.
Or longer, but named BITAND, BITOR.

Or we can use %and, %or (binary numbers start with %, so this is
somewhat logical).

Jakub Husak

unread,
Nov 27, 2010, 2:01:34 PM11/27/10
to Atalan Programming Langugage


On Nov 27, 3:58 pm, rudla <rudla.ku...@gmail.com> wrote:
> Atalan currently uses AND and OR for both logical and binary
> operators.
>
> This however does not work very well in conditions.
>
> if a = 5 and 7 then ...
>
> should be binary operator but
>
> if a = 5 and 7 = b then ....
>
> should be logical operator.
>
> This however does not parse well. It is necessary to rename binary
> operators to something else.
>
> XOR will probably remain same.
>
> We can use C-like operators  &, |.
> Or longer, but named  BITAND, BITOR.

IMHO BITAND and BITOR is simplest and clearest solution. In C we have
& and &&, so here we can have AND and BITAND.

Patrik Tkáč

unread,
Nov 27, 2010, 2:07:11 PM11/27/10
to atala...@googlegroups.com

It is necessary to distinguish between logical and binary operators also
because of priority of operations in expression evaluation.
If there is the same symbol for logical and binary AND (f.e.), it is
confusing for building AST (Abstract sytax tree)


Dňa 27. 11. 2010 20:01, Jakub Husak wrote / napísal(a):
>
> On Nov 27, 3:58 pm, rudla<rudla.ku...@gmail.com> wrote:
>> Atalan currently uses AND and OR for both logical and binary
>> operators.
>>
>> This however does not work very well in conditions.
>>
>> if a = 5 and 7 then ...
>>
>> should be binary operator but
>>
>> if a = 5 and 7 = b then ....
>>
>> should be logical operator.
>>
>> This however does not parse well. It is necessary to rename binary
>> operators to something else.
>>
>> XOR will probably remain same.
>>

>> We can use C-like operators&, |.


>> Or longer, but named BITAND, BITOR.
> IMHO BITAND and BITOR is simplest and clearest solution. In C we have

> & and&&, so here we can have AND and BITAND.

rudla

unread,
Nov 27, 2010, 4:19:37 PM11/27/10
to Atalan Programming Langugage
In fact, I prefer this variant too. :-)
Reply all
Reply to author
Forward
0 new messages