Commit 1c93acea by POTTIER Francois

Code back-end: type annotations for values extracted out of the stack.

parent d3b2538b
2016/03/11:
In the code back-end, generate type annotations when extracting a semantic
value out of the stack. When working with a semantic value of some function
type, OCaml would incorrectly warn that this function does not use its
argument. This warning should now be gone.
2016/03/03:
Makefile changes, so as to support ocamlbuild 4.03, which seems to have
stricter hygiene rules than previous versions.
......
......@@ -715,10 +715,14 @@ let runcellparams var holds_state symbol =
let reducecellparams prod i holds_state symbol =
let ids = Production.identifiers prod in
(* The semantic value is bound to the variable [ids.(i)]. *)
let semvpat _t =
PVar ids.(i)
(* The semantic value is bound to the variable [ids.(i)]. Its type is [t]. As
of 2016/03/11, we generate a type annotation. Indeed, because of our use of
[magic], the semantic value would otherwise have an unknown type; and, if
it is a function, the OCaml compiler could warn (incorrectly) that this
function does not use its argument. *)
let semvpat t =
PAnnot (PVar ids.(i), t)
in
elementif (Invariant.endp symbol) (PVar (Printf.sprintf "_endpos_%s_" ids.(i))) @
......
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