Module Catala_utils.Cli

type backend_lang =
| En
| Fr
| Pl
type backend_option_builtin = [
| `Latex
| `Makefile
| `Html
| `Interpret
| `Interpret_Lcalc
| `Typecheck
| `OCaml
| `Python
| `Scalc
| `Lcalc
| `Dcalc
| `Scopelang
| `Exceptions
| `Proof
]
type 'a backend_option = [
| backend_option_builtin
| `Plugin of 'a
]
val languages : (string * backend_lang) list
val language_code : backend_lang -> string

Returns the lowercase two-letter language code

val backend_option_to_string : string backend_option -> string

backend_option_to_string backend returns the string representation of the given backend.

val backend_option_of_string : string -> string backend_option

backend_option_of_string backend returns the backend_option corresponding to the backend string.

Configuration globals

val source_files : string list Stdlib.ref

Source files to be compiled

val locale_lang : backend_lang Stdlib.ref
val contents : string Stdlib.ref
val debug_flag : bool Stdlib.ref
val style_flag : bool Stdlib.ref

Styles the terminal output

val optimize_flag : bool Stdlib.ref
val max_prec_digits : int Stdlib.ref

Max number of digits to show for decimal results

val trace_flag : bool Stdlib.ref
val disable_warnings_flag : bool Stdlib.ref
val check_invariants_flag : bool Stdlib.ref

Check structural invariants on the AST.

val disable_counterexamples : bool Stdlib.ref

Disables model-generated counterexamples for proofs that fail.

val avoid_exceptions_flag : bool Stdlib.ref

Avoids using try ... with exceptions when compiling the default calculus.

type message_format_enum =
| Human
| GNU(*

Format of error and warning messages output by the compiler.

*)
val message_format_flag : message_format_enum Stdlib.ref

CLI terms

val file : string Cmdliner.Term.t
val debug : bool Cmdliner.Term.t
val unstyled : bool Cmdliner.Term.t
val trace_opt : bool Cmdliner.Term.t
val check_invariants_opt : bool Cmdliner.Term.t
val wrap_weaved_output : bool Cmdliner.Term.t
val print_only_law : bool Cmdliner.Term.t
val backend : string Cmdliner.Term.t
val plugins_dirs : string list Cmdliner.Term.t
val language : string option Cmdliner.Term.t
val max_prec_digits_opt : int option Cmdliner.Term.t
val ex_scope : string option Cmdliner.Term.t
val output : string option Cmdliner.Term.t
type when_enum =
| Auto
| Always
| Never

The usual auto/always/never option argument

type options = {
debug : bool;
color : when_enum;
message_format : message_format_enum;
wrap_weaved_output : bool;
avoid_exceptions : bool;
backend : string;
plugins_dirs : string list;
language : string option;
max_prec_digits : int option;
trace : bool;
disable_warnings : bool;
disable_counterexamples : bool;
check_invariants : bool;
optimize : bool;
ex_scope : string option;
ex_variable : string option;
output_file : string option;
closure_conversion : bool;
print_only_law : bool;
}

Command-line application

val options : options Cmdliner.Term.t
val catala_t : ( string -> options -> 'a ) -> 'a Cmdliner.Term.t

Main entry point: catala_t file options

val set_option_globals : options -> unit
val version : string
val info : Cmdliner.Cmd.info

Terminal formatting

Markers

val with_style : ANSITerminal.style list -> ( 'a, unit, string ) Stdlib.format -> 'a
val format_with_style : ANSITerminal.style list -> Stdlib.Format.formatter -> string -> unit
val call_unstyled : ( unit -> 'a ) -> 'a

call_unstyled f calls the function f with the style_flag set to false during the execution.

val debug_marker : Stdlib.Format.formatter -> unit -> unit
val error_marker : Stdlib.Format.formatter -> unit -> unit
val warning_marker : Stdlib.Format.formatter -> unit -> unit
val result_marker : Stdlib.Format.formatter -> unit -> unit
val log_marker : Stdlib.Format.formatter -> unit -> unit

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
val add_prefix_to_each_line : string -> ( int -> string ) -> string

The int argument of the prefix corresponds to the line number, starting at 0

val debug_print : ( 'a, Stdlib.Format.formatter, unit ) Stdlib.format -> 'a
val debug_format : ( 'a, Stdlib.Format.formatter, unit ) Stdlib.format -> 'a
val error_print : ( 'a, Stdlib.Format.formatter, unit ) Stdlib.format -> 'a
val error_format : ( 'a, Stdlib.Format.formatter, unit ) Stdlib.format -> 'a
val warning_print : ( 'a, Stdlib.Format.formatter, unit ) Stdlib.format -> 'a
val warning_format : ( 'a, Stdlib.Format.formatter, unit ) Stdlib.format -> 'a
val result_print : ( 'a, Stdlib.Format.formatter, unit ) Stdlib.format -> 'a
val result_format : ( 'a, Stdlib.Format.formatter, unit ) Stdlib.format -> 'a
val log_print : ( 'a, Stdlib.Format.formatter, unit ) Stdlib.format -> 'a
val log_format : ( 'a, Stdlib.Format.formatter, unit ) Stdlib.format -> 'a