Skip to content

Commit 5080e77

Browse files
authored
Merge pull request #465 from mtzguido/pars
parser: allow nested quantifiers at the top level
2 parents 8668791 + ca67af7 commit 5080e77

File tree

3 files changed

+32
-6
lines changed

3 files changed

+32
-6
lines changed

src/ml/FStarC_Parser_Parse.mly

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -419,8 +419,8 @@ rawDecl:
419419
{
420420
let r = rr $loc in
421421
let lbs = focusLetBindings lbs r in
422-
if q <> Rec && List.length lbs <> 1
423-
then raise_error_text r Fatal_MultipleLetBinding "Unexpected multiple let-binding (Did you forget some rec qualifier ?)";
422+
if q <> Rec && FStarC_List.length lbs > Prims.parse_int "1"
423+
then raise_error_text (fst (nth lbs (Prims.parse_int "1"))).prange Fatal_MultipleLetBinding "Unexpected multiple let-binding (Did you forget some rec qualifier ?)";
424424
TopLevelLet(q, lbs)
425425
}
426426
| VAL c=constant

src/ml/pulseparser.mly

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -359,10 +359,10 @@ mutOrRefQualifier:
359359
| MUT { MUT }
360360
| REF { REF }
361361

362-
typX(X,Y):
363-
| t=Y { t }
362+
typX(X):
363+
| t=X { t }
364364

365-
| q=quantifier bs=binders DOT trigger=trigger e=X
365+
| q=quantifier bs=binders DOT trigger=trigger e=typX(X)
366366
{
367367
match bs with
368368
| [] ->
@@ -373,5 +373,5 @@ typX(X,Y):
373373
}
374374

375375
pulseSLProp:
376-
| p=typX(tmEqWith(appTermNoRecordExp), tmEqWith(appTermNoRecordExp))
376+
| p=typX(tmEqWith(appTermNoRecordExp))
377377
{ p }

test/nolib/QuantifierOps.fst

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
module QuantifierOps
2+
3+
#lang-pulse
4+
open Pulse.Nolib
5+
6+
let ( exists* ) : #a:Type -> (a -> slprop) -> slprop = admit()
7+
let ( forall+ ) : #a:Type -> (a -> slprop) -> slprop = admit()
8+
9+
let test =
10+
forall+ (x : int).
11+
exists* (y : int).
12+
emp
13+
14+
let test2 =
15+
exists* (y : int).
16+
forall+ (x : int).
17+
emp
18+
19+
fn def ()
20+
preserves
21+
forall+ (x : int).
22+
exists* (y : int).
23+
emp
24+
{
25+
()
26+
}

0 commit comments

Comments
 (0)