45c9b3835a143b1d373990a36fcec774776f0d17
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 open UnparameterizedSyntax
20 (* This is the [Error] exception. *)
31 excdef with exceq
= Some
excname
34 (* The type of the entry point for the start symbol [symbol]. *)
36 let entrytypescheme symbol
=
39 StringMap.find symbol
PreFront.grammar
.types
41 (* Every start symbol should have a type. *)
44 type2scheme
(marrow
[ arrow tlexbuf ttoken
; tlexbuf
] (TypTextual
ocamltype))
46 (* This is the interface of the generated parser. *)
51 PreFront.grammar
.parameters
;
60 StringSet.fold
(fun symbol decls
->
61 (Misc.normalize symbol
, entrytypescheme symbol
) :: decls
62 ) PreFront.grammar
.start_symbols
[]
66 (* Writing the interface to a file. *)
69 let mli = open_out
(Settings.base ^
".mli") in
70 let module P
= Printer.Make
(struct
72 let locate_stretches = None
73 let raw_stretch_action = false
75 P.interface interface;