settings.mli 8.05 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13
(******************************************************************************)
(*                                                                            *)
(*                                   Menhir                                   *)
(*                                                                            *)
(*                       François Pottier, Inria Paris                        *)
(*              Yann Régis-Gianas, PPS, Université Paris Diderot              *)
(*                                                                            *)
(*  Copyright Inria. All rights reserved. This file is distributed under the  *)
(*  terms of the GNU General Public License version 2, as described in the    *)
(*  file LICENSE.                                                             *)
(*                                                                            *)
(******************************************************************************)

14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
(* This module parses the command line. *)

(* The list of file names that appear on the command line. *)

val filenames: string list

(* How to deal with the type of tokens. *)

type token_type_mode =
  | TokenTypeAndCode   (* produce the definition of the [token] type and code for the parser *)
  | TokenTypeOnly      (* produce the type definition only *)
  | CodeOnly of string (* produce the code only, by relying on an external token type *)

val token_type_mode: token_type_mode

(* How to construct the automaton. *)

type construction_mode =
  | ModeCanonical     (* --canonical: canonical Knuth LR(1) automaton *)
  | ModeInclusionOnly (* --no-pager : states are merged when there is an inclusion
34
                                      relationship, default reductions are used *)
35
  | ModePager         (* normal mode: states are merged as per Pager's criterion,
36
                                      default reductions are used *)
37 38
  | ModeLALR          (* --lalr     : states are merged as in an LALR generator,
                                      i.e. as soon as they have the same LR(0) core *)
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66

val construction_mode: construction_mode

(* Whether conflicts should be explained. *)

val explain: bool

(* Whether the automaton should be dumped. *)

val dump: bool

(* Whether the automaton's construction should be explained (very verbose). *)

val follow: bool

(* Whether the grammar's dependence graph should be dumped. *)

val graph: bool

(* Whether tracing instructions should be generated. *)

val trace: bool

(* Whether one should stop and print the grammar after joining and
   expanding the grammar. *)

type print_mode =
    | PrintNormal
67
    | PrintForOCamlyacc
68
    | PrintUnitActions of bool       (* if true, declare unit tokens *)
69 70 71 72 73 74 75

type preprocess_mode =
    | PMNormal                       (* preprocess and continue *)
    | PMOnlyPreprocess of print_mode (* preprocess, print grammar, stop *)

val preprocess_mode: preprocess_mode

76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
(* Whether and how OCaml type inference (for semantic actions and nonterminal
   symbols) should be performed. See the manual for details. *)

type infer_mode =
    (* Perform no type inference. This is the default mode. *)
  | IMNone
    (* Perform type inference by invoking ocamlc directly. *)
  | IMInfer                (* --infer *)
  | IMDependRaw            (* --raw-depend *)
  | IMDependPostprocess    (* --depend *)
    (* Perform type inference by writing a mock .ml file and
       reading the corresponding inferred .mli file. *)
  | IMWriteQuery of string (* --infer-write-query <filename> *)
  | IMReadReply of string  (* --infer-read-reply <filename> *)

val infer: infer_mode
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145

(* Whether one should inline the non terminal definitions marked
   with the %inline keyword. *)

val inline: bool

(* Whether comments should be printed or discarded. *)

val comment: bool

(* This undocumented flag suppresses prefixing of identifiers with an
   unlikely prefix in the generated code. This increases the code's
   readability, but can cause identifiers in semantic actions to be
   captured. *)

val noprefix: bool

(* This undocumented flag causes the code to be transformed by
   [Inline]. It is on by default. *)

val code_inlining: bool

(* How [ocamlc] and [ocamldep] should be invoked. *)

val ocamlc: string
val ocamldep: string

(* How verbose we should be. *)

val logG: int (* diagnostics on the grammar *)
val logA: int (* diagnostics on the automaton *)
val logC: int (* diagnostics on the generated code *)

(* Whether tasks should be timed. *)

val timings: bool

(* The base name that should be used for the files that we create.
   This name can contain a path. *)

val base: string

(* The filename of the standard library. *)

val stdlib_filename : string

(* Whether Menhir should behave as an interpreter. *)

val interpret : bool

(* Whether the interpreter should build and display concrete syntax trees. *)

val interpret_show_cst : bool

146 147 148 149 150 151
(* Whether Menhir should behave as an interpreter, in a special mode where
   it checks one input sentence, expecting it to trigger an error at the
   last token, and displays which state was reached. *)

val interpret_error : bool

152 153 154 155 156
(* Whether to use the table-based back-end ([true]) or the code-based
   back-end ([false]). *)

val table : bool

157 158 159 160 161
(* Whether to generate the inspection API (which requires GADTs, and
   requires producing more tables). *)

val inspection : bool

162 163 164 165
(* Whether to generate a coq description of the grammar and automaton. *)

val coq : bool

166 167 168 169
(* Whether to generate a version check for MenhirLib in the generated parser. *)

val coq_no_version_check : bool

170 171 172 173 174 175 176 177 178 179 180 181 182
(* Whether the coq description must contain completeness proofs. *)

val coq_no_complete : bool

(* Whether the coq backend should ignore types and semantic actions. *)

val coq_no_actions : bool

(* Whether unresolved LR(1) conflicts, useless precedence declarations,
   productions that are never reduced, etc. should be treated as errors. *)

val strict: bool

183 184 185 186 187 188 189 190
(* This flag causes the exception [Error] should be declared equal to
   [Parsing.Parse_error]. This is useful when full compatibility with
   ocamlyacc is desired. In particular, this is used when building
   Menhir itself, since Menhir is compiled first using ocamlyacc, then
   using Menhir. *)

val fixedexc: bool

191 192 193 194 195 196 197 198 199 200
(* This is a set of tokens which may be unused and about which we should not
   emit a warning. *)

val ignored_unused_tokens: StringSet.t

(* This flag supersedes the set [ignored_unused_tokens]. If it is set, then
   we should not emit a warning about any unused tokens. *)

val ignore_all_unused_tokens: bool

201 202 203 204
(* This flag suppresses all warnings about unused precedence levels. *)

val ignore_all_unused_precedence_levels: bool

205 206 207 208 209
(* This flag causes Menhir to produce a list of erroneous input sentences.
   Enough sentences are computed to produce exactly one error in every state
   where an error can occur. *)

val list_errors: bool
210 211 212 213 214 215

(* This flag causes Menhir to read the error message descriptions stored in
   [filename] and compile them to OCaml code. *)

val compile_errors: string option

216 217 218 219 220
(* If present, this is a pair of .messages files whose contents should
   be compared. *)

val compare_errors: (string * string) option

221 222 223 224 225 226 227
(* This flag causes Menhir to read the error message descriptions stored in
   [filename] and re-generate the auto-generated comments, which begin with
   [##]. This allows bringing these comments up to date when the grammar
   evolves. *)

val update_errors: string option

POTTIER Francois's avatar
POTTIER Francois committed
228 229 230 231 232
(* This flag causes Menhir to read the error message descriptions stored in
   [filename] and echo the error sentences (and nothing else; no messages,
   no comments). *)

val echo_errors: string option
233 234 235 236 237

(* This flag causes Menhir to produce a [.cmly] file, which contains a
   binary-format description of the grammar and automaton. *)

val cmly: bool
238

239 240 241 242 243 244
(* This name is used in --coq mode. It appears in the generated Coq file,
   and indicates under what name (or path) the Coq library MenhirLib is
   known. Its default value is [Some "MenhirLib"]. *)

val coq_lib_path: string option

245 246 247 248 249 250 251
(* This flag tells whether [$i] notation in semantic actions is allowed. *)

type dollars =
  | DollarsDisallowed
  | DollarsAllowed

val dollars: dollars