summaryrefslogtreecommitdiff
path: root/src/parser.mly
diff options
context:
space:
mode:
authorKathy Gray2014-11-21 16:49:55 +0000
committerKathy Gray2014-11-21 16:49:55 +0000
commitbb25c51fc215faf5953d38aa9b0f03249b24a2b7 (patch)
tree230d91dfe6084f3f6d1ce45e9f1c2fc3ca751add /src/parser.mly
parent405fa876b603703185ea834f65ddd14808544331 (diff)
Support signed and unsigned arithmetic
Diffstat (limited to 'src/parser.mly')
-rw-r--r--src/parser.mly10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/parser.mly b/src/parser.mly
index 6d019af4..943a2669 100644
--- a/src/parser.mly
+++ b/src/parser.mly
@@ -160,7 +160,7 @@ let make_vector_sugar order_set is_inc typ typ1 =
%token <string> GtEqUnderS GtEqUnderSi GtEqUnderU GtEqUnderUi GtGtUnderU GtUnderS
%token <string> GtUnderSi GtUnderU GtUnderUi LtEqUnderS LtEqUnderSi LtEqUnderU
%token <string> LtEqUnderUi LtUnderS LtUnderSi LtUnderU LtUnderUi StarStarUnderS StarStarUnderSi StarUnderS
-%token <string> StarUnderSi StarUnderU StarUnderUi TwoCarrot
+%token <string> StarUnderSi StarUnderU StarUnderUi TwoCarrot PlusUnderS MinusUnderS
%token <string> AmpI AtI CarrotI DivI EqI ExclI GtI LtI PlusI StarI TildeI
%token <string> AmpAmpI CarrotCarrotI ColonColonI EqDivEqI EqEqI ExclEqI ExclExclI
@@ -209,10 +209,14 @@ id:
{ idl (DeIid($3)) }
| Lparen Deinfix Minus Rparen
{ idl (DeIid("-")) }
+ | Lparen Deinfix MinusUnderS Rparen
+ { idl (DeIid("-_s")) }
| Lparen Deinfix Mod Rparen
{ idl (DeIid("mod")) }
| Lparen Deinfix Plus Rparen
{ idl (DeIid($3)) }
+ | Lparen Deinfix PlusUnderS Rparen
+ { idl (DeIid("+_s")) }
| Lparen Deinfix Star Rparen
{ idl (DeIid($3)) }
| Lparen Deinfix AmpAmp Rparen
@@ -700,8 +704,12 @@ plus_exp:
{ $1 }
| plus_exp Plus star_exp
{ eloc (E_app_infix($1,Id_aux(Id($2), locn 2 2), $3)) }
+ | plus_exp PlusUnderS star_exp
+ { eloc (E_app_infix($1, Id_aux(Id($2), locn 2 2), $3)) }
| plus_exp Minus star_exp
{ eloc (E_app_infix($1,Id_aux(Id("-"), locn 2 2), $3)) }
+ | plus_exp MinusUnderS star_exp
+ { eloc (E_app_infix($1,Id_aux(Id("-_s"),locn 2 2), $3)) }
plus_right_atomic_exp:
| star_right_atomic_exp