1 (**************************************************************************)
5 (* François Pottier, INRIA Rocquencourt *)
6 (* Yann Régis-Gianas, PPS, Université Paris Diderot *)
8 (* Copyright 2005-2008 Institut National de Recherche en Informatique *)
9 (* et en Automatique. All rights reserved. This file is distributed *)
10 (* under the terms of the Q Public License version 1.0, with the change *)
11 (* described in file LICENSE. *)
13 (**************************************************************************)
15 (* Driver for the back-end. *)
17 open UnparameterizedSyntax
19 (* Define an .ml file writer . *)
22 let module P
= Printer.Make
(struct
23 let filename = Settings.base ^
".ml"
24 let f = open_out
filename
25 let locate_stretches =
26 if Settings.infer
then
27 (* Typechecking should not fail at this stage. Omit #line directives. *)
30 (* 2011/10/19: do not use [Filename.basename]. The [#] annotations that
31 we insert in the [.ml] file must retain their full path. This does
32 mean that the [#] annotations depend on how menhir is invoked -- e.g.
33 [menhir foo/bar.mly] and [cd foo && menhir bar.mly] will produce
34 different files. Nevertheless, this seems useful/reasonable. *)
36 let raw_stretch_action = false
40 (* Construct the code, using either the table-based or the code-based
41 back-end, and pass it on to the printer. (This continuation-passing
42 style is imposed by the fact that there is no conditional in ocaml's
47 let module B
= CoqBackend.Run
(struct end) in
48 let filename = Settings.base ^
".v" in
49 let f = open_out
filename in
53 if Settings.table
then
54 let module B
= TableBackend.Run
(struct end) in
57 let module B
= CodeBackend.Run
(struct end) in
58 write (Inliner.inline
B.program
)
60 (* Write the interface file. *)