4a3630f8decf6d62b619d8abbc1bdf6654b58b68
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 (* Start where [PreFront] left off. *)
20 (* Perform reachability analysis. *)
23 Reachability.trim
grammar
28 (* If [--depend] was specified on the command line, perform
29 dependency analysis and stop. *)
32 match Settings.depend
with
34 | Settings.OMPostprocess
->
35 Infer.depend
grammar (* never returns *)
39 (* If [--infer] was specified on the command line, perform
40 type inference and stop. *)
43 if Settings.infer
then
44 let grammar = Infer.infer
grammar in
45 Time.tick
"Inferring types for nonterminals";
50 (* If [--no-inline] was specified on the command line, skip the
51 inlining of non terminal definitions marked with %inline. *)
54 if Settings.inline
then begin
55 let grammar, inlined
=
56 NonTerminalDefinitionInlining.inline
grammar
58 if not
Settings.infer
&& inlined
&& not
Settings.coq
then
60 "you are using the standard library and/or the %inline keyword. We\n\
61 recommend switching on --infer in order to avoid obscure type error messages.";
68 (* If [--only-preprocess] or [--only-preprocess-drop] was specified on the
69 command line, print the grammar and stop. Otherwise, continue. *)
72 match Settings.preprocess_mode
with
73 | Settings.PMOnlyPreprocess mode
->
74 UnparameterizedPrinter.print mode stdout
grammar;
76 | Settings.PMNormal
->