Module Shared_ast.Print

Printing functions for the default calculus AST

Common syntax highlighting helpers

val base_type : Stdlib.Format.formatter -> string -> unit
val keyword : Stdlib.Format.formatter -> string -> unit
val punctuation : Stdlib.Format.formatter -> string -> unit

The argument is assumed to be 1-column wide (but can be a multi-char utf8 character)

val op_style : Stdlib.Format.formatter -> string -> unit
val lit_style : Stdlib.Format.formatter -> string -> unit

Some basic stringifiers

val operator_to_string : 'a Shared_ast__Definitions.Op.t -> string

Prints the operator symbols with kind suffixes, as expected by the OCaml backend (e.g. "+^", "+$", etc.)

Formatters

val uid_list : Stdlib.Format.formatter -> Catala_utils.Uid.MarkedString.info list -> unit
val enum_constructor : Stdlib.Format.formatter -> Shared_ast__Definitions.EnumConstructor.t -> unit
val tlit : Stdlib.Format.formatter -> Shared_ast__Definitions.typ_lit -> unit
val location : Stdlib.Format.formatter -> 'a Shared_ast__Definitions.glocation -> unit
val typ : Shared_ast__Definitions.decl_ctx -> Stdlib.Format.formatter -> Shared_ast__Definitions.naked_typ Catala_utils.Mark.pos -> unit
val lit : Stdlib.Format.formatter -> Shared_ast__Definitions.lit -> unit
val operator : ?debug:bool -> Stdlib.Format.formatter -> 'a Shared_ast__Definitions.Op.t -> unit
val log_entry : Stdlib.Format.formatter -> Shared_ast__Definitions.log_entry -> unit
val except : Stdlib.Format.formatter -> Shared_ast__Definitions.except -> unit
val var : Stdlib.Format.formatter -> 'e Var.t -> unit
val var_debug : Stdlib.Format.formatter -> 'e Var.t -> unit
val expr : ?hide_function_body:bool -> ?debug:bool -> unit -> Stdlib.Format.formatter -> ( ( 'a, 'a, 'm ) Shared_ast__Definitions.base_gexpr, 'm Shared_ast__Definitions.mark ) Catala_utils.Mark.ed -> unit

Same as expr, but with a debug flag that defaults to !Cli.debug_flag. If ~hide_function_body:true, prints "<function>" for EAbs nodes

Debugging versions that don't require a context

val typ_debug : Stdlib.Format.formatter -> Shared_ast__Definitions.naked_typ Catala_utils.Mark.pos -> unit
val scope : ?debug:bool -> Shared_ast__Definitions.decl_ctx -> Stdlib.Format.formatter -> (Shared_ast__Definitions.ScopeName.t * ( ( 'a, 'a, 'm ) Shared_ast__Definitions.base_gexpr, 'm Shared_ast__Definitions.mark ) Catala_utils.Mark.ed Shared_ast__Definitions.scope_body) -> unit
val program : ?debug:bool -> Stdlib.Format.formatter -> ( ( 'a, 'a, 'm ) Shared_ast__Definitions.base_gexpr, 'm Shared_ast__Definitions.mark ) Catala_utils.Mark.ed Shared_ast__Definitions.program -> unit