I add three new operators:
** is the integer power (Fortran syntax)
^ is the logical xor
>>> is the unsigned / logical right shift (Java syntax)
>> is now the signed right shift
(and by the way, there is no such thing as singed / unsigned left
shift :)
I also added %= which was missing
Here is the precedence I implemented now (from lower priority to
higher):
%right = += -= *= /= %= <<= >>= >>>=
%left ||
%left &&
%nonassoc < > == != >= <= ><
%left |
%left ^
%left &
%nonassoc >> >>> <<
%left + -
%left * / %
%left - (unary minus) ~
%right **
%nonassoc ++ --
I know that this precedence is not like
- C; but C precedence really sucks
- Java; but you cannot imagine how much I hate this language and the
marketing s** around it
- Perl; but so many Perl operators are missing (and, or, etc.)
%nonassoc means that those constructions are rejected:
x << y << z
++ x ++
x ++ ++
x > y > z
"a" >< str >< "b"
%right means that 2**3**2 is parsed as 2**(3**2) = 2**9 and not
(2**3)**2 = 8**2
--
mailto:arboi@alussinan.org
GPG Public keys: http://michel.arboi.free.fr/pubkey.txt
http://michel.arboi.free.fr/ http://arboi.da.ru/
FAQNOPI de fr.comp.securite : http://faqnopi.da.ru/
** is the integer power (Fortran syntax)
^ is the logical xor
>>> is the unsigned / logical right shift (Java syntax)
>> is now the signed right shift
(and by the way, there is no such thing as singed / unsigned left
shift :)
I also added %= which was missing
Here is the precedence I implemented now (from lower priority to
higher):
%right = += -= *= /= %= <<= >>= >>>=
%left ||
%left &&
%nonassoc < > == != >= <= ><
%left |
%left ^
%left &
%nonassoc >> >>> <<
%left + -
%left * / %
%left - (unary minus) ~
%right **
%nonassoc ++ --
I know that this precedence is not like
- C; but C precedence really sucks
- Java; but you cannot imagine how much I hate this language and the
marketing s** around it
- Perl; but so many Perl operators are missing (and, or, etc.)
%nonassoc means that those constructions are rejected:
x << y << z
++ x ++
x ++ ++
x > y > z
"a" >< str >< "b"
%right means that 2**3**2 is parsed as 2**(3**2) = 2**9 and not
(2**3)**2 = 8**2
--
mailto:arboi@alussinan.org
GPG Public keys: http://michel.arboi.free.fr/pubkey.txt
http://michel.arboi.free.fr/ http://arboi.da.ru/
FAQNOPI de fr.comp.securite : http://faqnopi.da.ru/