summaryrefslogtreecommitdiff
path: root/src/parser2.mly
diff options
context:
space:
mode:
authorAlasdair Armstrong2018-01-02 14:28:18 +0000
committerAlasdair Armstrong2018-01-02 14:28:18 +0000
commit4bb1e41bc2a1ae93e26094d827f43d2d21ec8223 (patch)
tree99fb13e274647a4ff617a07add51d153d415cd67 /src/parser2.mly
parentb3d2aa1f4d4b60e0a5a9c05127c81504e6b9a0c4 (diff)
Experimenting with power spec
Diffstat (limited to 'src/parser2.mly')
-rw-r--r--src/parser2.mly6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/parser2.mly b/src/parser2.mly
index 140f1b86..74812d1e 100644
--- a/src/parser2.mly
+++ b/src/parser2.mly
@@ -152,7 +152,7 @@ let rec desugar_rchain chain s e =
%token Pure Register Return Scattered Sizeof Struct Then True TwoCaret TYPE Typedef
%token Undefined Union With Val Constraint Throw Try Catch Exit
%token Barr Depend Rreg Wreg Rmem Rmemt Wmem Wmv Wmvt Eamem Exmem Undef Unspec Nondet Escape
-%token Repeat Until While Do Record Mutual
+%token Repeat Until While Do Record Mutual Var
%nonassoc Then
%nonassoc Else
@@ -705,6 +705,8 @@ exp:
{ mk_exp (E_assign ($1, $3)) $startpos $endpos }
| Let_ letbind In exp
{ mk_exp (E_let ($2, $4)) $startpos $endpos }
+ | Var atomic_exp Eq exp In exp
+ { mk_exp (E_var ($2, $4, $6)) $startpos $endpos }
| Lcurly block Rcurly
{ mk_exp (E_block $2) $startpos $endpos }
| Return exp
@@ -935,6 +937,8 @@ block:
{ [$1] }
| Let_ letbind Semi block
{ [mk_exp (E_let ($2, mk_exp (E_block $4) $startpos($4) $endpos)) $startpos $endpos] }
+ | Var atomic_exp Eq exp Semi block
+ { [mk_exp (E_var ($2, $4, mk_exp (E_block $6) $startpos($6) $endpos)) $startpos $endpos] }
| exp Semi /* Allow trailing semicolon in block */
{ [$1] }
| exp Semi block