Commit d34dc7df by Zachary Snow

support for arithmetic shifts

parent d4c6c0d0
......@@ -228,6 +228,8 @@ data BinOp
| Le
| Gt
| Ge
| ShiftAL
| ShiftAR
deriving Eq
instance Show BinOp where
......@@ -250,6 +252,8 @@ instance Show BinOp where
Le -> "<="
Gt -> ">"
Ge -> ">="
ShiftAL -> "<<<"
ShiftAR -> ">>>"
instance Show Expr where
show x = case x of
......
......@@ -148,7 +148,7 @@ string { Token Lit_string _ _ }
%left "&" "~&"
%left "==" "!=" "===" "!=="
%left "<" "<=" ">" ">="
%left "<<" ">>"
%left "<<" ">>" "<<<" ">>>"
%left "+" "-"
%left "*" "/" "%"
%left UPlus UMinus "!" "~" RedOps
......@@ -420,6 +420,8 @@ Expr :: { Expr }
| Expr "*" Expr { BinOp Mul $1 $3 }
| Expr "/" Expr { BinOp Div $1 $3 }
| Expr "%" Expr { BinOp Mod $1 $3 }
| Expr "<<<" Expr { BinOp ShiftAL $1 $3 }
| Expr ">>>" Expr { BinOp ShiftAR $1 $3 }
| "!" Expr { UniOp Not $2 }
| "~" Expr { UniOp BWNot $2 }
| "+" Expr %prec UPlus { UniOp UAdd $2 }
......
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