diff options
author | Hugo Herbelin <Hugo.Herbelin@inria.fr> | 2017-11-23 13:42:41 +0100 |
---|---|---|
committer | Hugo Herbelin <Hugo.Herbelin@inria.fr> | 2018-02-20 10:03:08 +0100 |
commit | 0af54860172efe1aa5da419b81e4cb34348320ee (patch) | |
tree | 71f16927d6d98c2aa7ef3b28383ca2b2b0d2c4d1 /test-suite/output | |
parent | 9fe03a830ae7b10e1c5fb2b9d41213257bd617f0 (diff) |
Trying a hack to support {'pat|P} without breaking compatibility.
Concretely, we bypass the following limitation: The notation
"{ ' pat | P }" broke the parsing of expressions of the form
"{ forall x, P } + { Q }". Indeed the latter works thanks to a
tolerance of Camlp5 in parsing "forall x, P" at level 200 while the
rule asks to actually parse the interior of "{ ... }" at level 99 (the
reason for 99 is to be below the rule for "M : T" which is at level
100, so that "{ x : A | P }" does not see "x : A" as a cast). Adding
an extra "'"; pat = pattern in parallel to c = constr LEVEL "99" broke
the tolerance for constr at level 200.
We fix this by adding an ad hoc rule for "{ binder_constr }" in the
native grammar (g_constr.ml4).
Actually, this is inconsistent with having a rule for "{ constr at level 99 }"
in Notations.v. We should have both rules in Notations.v or both rules
hard-wired in the native grammar. But I still don't know what is the best
decision to take, so leaving as it at the current time.
Advantages of hard-wiring both rules in g_constr.ml4: a bit simpler in
metasyntax.ml (no need to ensure that the rule exist). Disadvantages:
if one wants a different initial state without the business needing
the "{ }" for sumbool, sumor, sig, sigT, one still have the rules
there.
Advantages of having them in Notations.v: more modular, we can change
the initial state. Disadvantages: one would need a new kind of
modifier, something like "x at level 99 || binder_constr", with all
the difficulty to find a nice, intuitive, name for "binder_constr",
and the difficulty of understanding if there is a generality to this
"||" disjunction operator, and whether it should be documented or not.
Diffstat (limited to 'test-suite/output')
-rw-r--r-- | test-suite/output/Notations3.v | 2 |
1 files changed, 0 insertions, 2 deletions
diff --git a/test-suite/output/Notations3.v b/test-suite/output/Notations3.v index f41ddac4d..c98bfff41 100644 --- a/test-suite/output/Notations3.v +++ b/test-suite/output/Notations3.v @@ -341,8 +341,6 @@ Check fun x => if x is n.+1 then n else 1. (* Examples with binding patterns *) -Import SpecifPatternNotations. - Check {'(x,y)|x+y=0}. Module D. |