package catala

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

Printing functions for the default calculus AST

Common syntax highlighting helpers

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

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

val op_style : Format.formatter -> string -> unit
val lit_style : 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 tlit : Format.formatter -> Shared_ast__.Definitions.typ_lit -> unit
val location : Format.formatter -> 'a Shared_ast__.Definitions.glocation -> unit
val external_ref : Format.formatter -> Shared_ast__.Definitions.external_ref Catala_utils.Mark.pos -> unit
val typ : Shared_ast__.Definitions.decl_ctx -> Format.formatter -> Shared_ast__.Definitions.naked_typ Catala_utils.Mark.pos -> unit
val lit : Format.formatter -> Shared_ast__.Definitions.lit -> unit
val operator : ?debug:bool -> Format.formatter -> 'a Shared_ast__.Definitions.Op.t -> unit
val log_entry : Format.formatter -> Shared_ast__.Definitions.log_entry -> unit
val except : Format.formatter -> Shared_ast__.Definitions.except -> unit
val var : Format.formatter -> 'e Var.t -> unit
val var_debug : Format.formatter -> 'e Var.t -> unit
val expr : ?debug:bool -> unit -> Format.formatter -> (('a, 'a, 'm) Shared_ast__.Definitions.base_gexpr, 'm Shared_ast__.Definitions.mark) Catala_utils.Mark.ed -> unit

Expression printer.

  • parameter debug

    (default to the global setting) turns on printing of logging nodes, variable indices and operator suffixes. See the interface below for more detailed control.

Generic expression printer interface

module type EXPR_PARAM = sig ... end
module ExprGen (_ : EXPR_PARAM) : sig ... end

Debugging versions that don't require a context

val typ_debug : Format.formatter -> Shared_ast__.Definitions.naked_typ Catala_utils.Mark.pos -> unit
val scope : ?debug:bool -> Shared_ast__.Definitions.decl_ctx -> 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 -> Format.formatter -> (('a, 'a, 'm) Shared_ast__.Definitions.base_gexpr, 'm Shared_ast__.Definitions.mark) Catala_utils.Mark.ed Shared_ast__.Definitions.program -> unit
module UserFacing : sig ... end

User-facing, localised printer

/

val skip_wrappers : (('a, 'a, 'm) Shared_ast__.Definitions.base_gexpr, 'm Shared_ast__.Definitions.mark) Catala_utils.Mark.ed -> (('a, 'a, 'm) Shared_ast__.Definitions.base_gexpr, 'm Shared_ast__.Definitions.mark) Catala_utils.Mark.ed

This is exported from Expr, but first defined here for dependency reasons