catala/compiler/utils/cli.mli

146 lines
3.6 KiB
OCaml
Raw Normal View History

2021-02-12 19:20:14 +03:00
(* This file is part of the Catala compiler, a specification language for tax and social benefits
computation rules. Copyright (C) 2020 Inria, contributors: Denis Merigoux
<denis.merigoux@inria.fr>, Emile Rolley <emile.rolley@tuta.io>
2021-02-12 19:20:14 +03:00
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License
is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
or implied. See the License for the specific language governing permissions and limitations under
the License. *)
type backend_lang = En | Fr | Pl
2021-02-12 19:20:14 +03:00
(** {2 Configuration globals} *)
val source_files : string list ref
2021-02-12 20:16:06 +03:00
(** Source files to be compiled *)
2021-02-12 19:20:14 +03:00
val locale_lang : backend_lang ref
2021-02-12 19:20:14 +03:00
val contents : string ref
2021-02-12 19:20:14 +03:00
val debug_flag : bool ref
2021-02-12 19:20:14 +03:00
val style_flag : bool ref
2021-02-12 20:16:06 +03:00
(** Styles the terminal output *)
2021-02-12 19:20:14 +03:00
2021-04-03 14:44:11 +03:00
val optimize_flag : bool ref
val max_prec_digits : int ref
2021-02-12 20:16:06 +03:00
(** Max number of digits to show for decimal results *)
2021-02-12 19:20:14 +03:00
val trace_flag : bool ref
2021-02-12 19:20:14 +03:00
val disable_counterexamples : bool ref
(** Disables model-generated counterexamples for proofs that fail. *)
2022-02-24 18:46:02 +03:00
val avoid_exceptions_flag : bool ref
(** Avoids using [try ... with] exceptions when compiling the default calculus. *)
2021-02-12 19:20:14 +03:00
(** {2 CLI terms} *)
val file : string Cmdliner.Term.t
2021-02-12 19:20:14 +03:00
val debug : bool Cmdliner.Term.t
2021-02-12 19:20:14 +03:00
val unstyled : bool Cmdliner.Term.t
2021-02-12 19:20:14 +03:00
val trace_opt : bool Cmdliner.Term.t
2021-02-12 19:20:14 +03:00
val wrap_weaved_output : bool Cmdliner.Term.t
2021-02-12 19:20:14 +03:00
val backend : string Cmdliner.Term.t
2021-02-12 19:20:14 +03:00
type backend_option =
| Dcalc
| Html
| Interpret
| Latex
| Lcalc
| Makefile
| OCaml
| Proof
| Python
2022-02-14 19:01:34 +03:00
| Scalc
| Scopelang
| Typecheck
2021-02-12 19:20:14 +03:00
val language : string option Cmdliner.Term.t
2021-02-12 19:20:14 +03:00
val max_prec_digits_opt : int option Cmdliner.Term.t
2021-02-12 19:20:14 +03:00
val ex_scope : string option Cmdliner.Term.t
2021-02-12 19:20:14 +03:00
val output : string option Cmdliner.Term.t
2021-02-12 19:20:14 +03:00
val catala_t :
(string ->
2021-02-12 20:16:06 +03:00
bool ->
bool ->
bool ->
bool ->
2021-02-12 20:16:06 +03:00
string ->
string option ->
int option ->
bool ->
2021-04-03 14:44:11 +03:00
bool ->
bool ->
2021-02-12 20:16:06 +03:00
string option ->
string option ->
'a) ->
'a Cmdliner.Term.t
2021-03-02 20:27:39 +03:00
(** Main entry point:
[catala_t file debug unstyled wrap_weaved_output avoid_exceptions backend language max_prec_digits_opt trace_opt disable_counterexamples optimize ex_scope output] *)
2021-02-12 19:20:14 +03:00
val version : string
2021-02-12 20:16:06 +03:00
val info : Cmdliner.Term.info
2021-02-12 19:20:14 +03:00
(**{1 Terminal formatting}*)
(**{2 Markers}*)
val with_style : ANSITerminal.style list -> ('a, unit, string) format -> 'a
2021-02-12 20:16:06 +03:00
val format_with_style : ANSITerminal.style list -> Format.formatter -> string -> unit
val debug_marker : unit -> string
2021-02-12 20:16:06 +03:00
val error_marker : unit -> string
2021-02-12 20:16:06 +03:00
val warning_marker : unit -> string
2021-02-12 20:16:06 +03:00
val result_marker : unit -> string
2021-02-12 20:16:06 +03:00
val log_marker : unit -> string
2021-02-12 19:20:14 +03:00
(**{2 Printers}*)
(** All the printers below print their argument after the correct marker *)
val concat_with_line_depending_prefix_and_suffix :
(int -> string) -> (int -> string) -> string list -> string
2021-02-12 19:20:14 +03:00
val add_prefix_to_each_line : string -> (int -> string) -> string
2021-02-12 20:16:06 +03:00
(** The int argument of the prefix corresponds to the line number, starting at 0 *)
2021-02-12 19:20:14 +03:00
val debug_print : ('a, out_channel, unit) format -> 'a
2021-02-12 19:20:14 +03:00
val debug_format : ('a, Format.formatter, unit) format -> 'a
2021-02-12 19:20:14 +03:00
val error_print : ('a, out_channel, unit) format -> 'a
2021-02-12 19:20:14 +03:00
val warning_print : ('a, out_channel, unit) format -> 'a
2021-02-12 19:20:14 +03:00
val result_print : ('a, out_channel, unit) format -> 'a
val result_format : ('a, Format.formatter, unit) format -> 'a
val log_print : ('a, out_channel, unit) format -> 'a
val log_format : ('a, Format.formatter, unit) format -> 'a