Commit c4f5718f by Zachary Snow

support for binary xnor

parent 2314f97a
...@@ -41,6 +41,7 @@ data BinOp ...@@ -41,6 +41,7 @@ data BinOp
| LogOr | LogOr
| BitAnd | BitAnd
| BitXor | BitXor
| BitXnor
| BitOr | BitOr
| Mul | Mul
| Div | Div
...@@ -69,6 +70,7 @@ instance Show BinOp where ...@@ -69,6 +70,7 @@ instance Show BinOp where
show LogOr = "||" show LogOr = "||"
show BitAnd = "&" show BitAnd = "&"
show BitXor = "^" show BitXor = "^"
show BitXnor = "~^"
show BitOr = "|" show BitOr = "|"
show Mul = "*" show Mul = "*"
show Div = "/" show Div = "/"
......
...@@ -221,7 +221,7 @@ directive { Token Spe_Directive _ _ } ...@@ -221,7 +221,7 @@ directive { Token Spe_Directive _ _ }
%left "||" %left "||"
%left "&&" %left "&&"
%left "|" "~|" %left "|" "~|"
%left "^" "^~" %left "^" "^~" "~^"
%left "&" "~&" %left "&" "~&"
%left "==" "!=" "===" "!==" "==?" "!=?" %left "==" "!=" "===" "!==" "==?" "!=?"
%left "<" "<=" ">" ">=" %left "<" "<=" ">" ">="
...@@ -781,6 +781,8 @@ Expr :: { Expr } ...@@ -781,6 +781,8 @@ Expr :: { Expr }
| Expr "|" Expr { BinOp BitOr $1 $3 } | Expr "|" Expr { BinOp BitOr $1 $3 }
| Expr "^" Expr { BinOp BitXor $1 $3 } | Expr "^" Expr { BinOp BitXor $1 $3 }
| Expr "&" Expr { BinOp BitAnd $1 $3 } | Expr "&" Expr { BinOp BitAnd $1 $3 }
| Expr "~^" Expr { BinOp BitXnor $1 $3 }
| Expr "^~" Expr { BinOp BitXnor $1 $3 }
| Expr "+" Expr { BinOp Add $1 $3 } | Expr "+" Expr { BinOp Add $1 $3 }
| Expr "-" Expr { BinOp Sub $1 $3 } | Expr "-" Expr { BinOp Sub $1 $3 }
| Expr "*" Expr { BinOp Mul $1 $3 } | Expr "*" Expr { BinOp Mul $1 $3 }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment