package catala

  1. Overview
  2. Docs
Compiler and library for the literate programming language for tax code specification

Install

Dune Dependency

Authors

Maintainers

Sources

0.10.0.tar.gz
md5=5abd76e8c51a47670645e91b21b57fc5
sha512=9c6fbe50c0b5a60566e877eeddadca0a339e2ce35deb5c1beceb03bc40eb6af2d519313e71859d88645b53fad591d4fa5288c633b185c9d765603da0f5b7dd7b

doc/catala.desugared/Desugared/Ast/index.html

Module Desugared.AstSource

Abstract syntax tree of the desugared representation

Sourcemodule ScopeDef : sig ... end

Inside a scope, a definition can refer to a variable (possibly an intermediate state thereof) or an input of a subscope.

AST

Expressions

Rules and scopes

Sourcetype exception_situation =
  1. | BaseCase
  2. | ExceptionToLabel of Shared_ast.LabelName.t Catala_utils.Mark.pos
  3. | ExceptionToRule of Shared_ast.RuleName.t Catala_utils.Mark.pos
Sourcetype label_situation =
  1. | ExplicitlyLabeled of Shared_ast.LabelName.t Catala_utils.Mark.pos
  2. | Unlabeled
Sourcetype rule = {
  1. rule_id : Shared_ast.RuleName.t;
  2. rule_just : expr Shared_ast.boxed;
  3. rule_cons : expr Shared_ast.boxed;
  4. rule_parameter : (expr Shared_ast.Var.t Catala_utils.Mark.pos * Shared_ast.typ) list Catala_utils.Mark.pos option;
  5. rule_exception : exception_situation;
  6. rule_label : label_situation;
}
Sourcemodule Rule : Set.OrderedType with type t = rule
Sourcetype assertion = expr Shared_ast.boxed
Sourcetype variation_typ =
  1. | Increasing
  2. | Decreasing
Sourcetype reference_typ =
  1. | Decree
  2. | Law
Sourcetype catala_option =
  1. | DateRounding of variation_typ
Sourcetype meta_assertion =
  1. | FixedBy of reference_typ Catala_utils.Mark.pos
  2. | VariesWith of unit * variation_typ Catala_utils.Mark.pos option
Sourcetype io = {
  1. io_output : bool Catala_utils.Mark.pos;
    (*

    true is present in the output of the scope.

    *)
  2. io_input : Shared_ast.Runtime.io_input Catala_utils.Mark.pos;
}

Characterization of the input/output status of a scope variable.

Sourcetype scope_def = {
  1. scope_def_rules : rule Shared_ast.RuleName.Map.t;
    (*

    empty outside of the root module

    *)
  2. scope_def_typ : Shared_ast.typ;
  3. scope_def_parameters : (Catala_utils.Uid.MarkedString.info * Shared_ast.typ) list Catala_utils.Mark.pos option;
  4. scope_def_is_condition : bool;
  5. scope_def_io : io;
}
Sourcetype var_or_states =
  1. | WholeVar
  2. | States of Shared_ast.StateName.t list
Sourcetype scope = {
  1. scope_vars : var_or_states Shared_ast.ScopeVar.Map.t;
  2. scope_sub_scopes : Shared_ast.ScopeName.t Shared_ast.ScopeVar.Map.t;
  3. scope_uid : Shared_ast.ScopeName.t;
  4. scope_defs : scope_def ScopeDef.Map.t;
  5. scope_assertions : assertion AssertionName.Map.t;
    (*

    empty outside of the root module

    *)
  6. scope_options : catala_option Catala_utils.Mark.pos list;
  7. scope_meta_assertions : meta_assertion list;
}
Sourcetype modul = {
  1. module_scopes : scope Shared_ast.ScopeName.Map.t;
  2. module_topdefs : (expr option * Shared_ast.typ) Shared_ast.TopdefName.Map.t;
    (*

    the expr is None outside of the root module

    *)
}
Sourcetype program = {
  1. program_module_name : Shared_ast.Ident.t Catala_utils.Mark.pos option;
  2. program_ctx : Shared_ast.decl_ctx;
  3. program_modules : modul Shared_ast.ModuleName.Map.t;
    (*

    Contains all submodules of the program, in a flattened structure

    *)
  4. program_root : modul;
  5. program_lang : Catala_utils.Global.backend_lang;
}

Helpers

Sourceval locations_used : expr -> LocationSet.t
Sourceval fold_exprs : f:('a -> expr -> 'a) -> init:'a -> program -> 'a

Usage: fold_exprs ~f ~init program applies ~f to all the expressions inside rules (justifications and consequences), expressions and top-level definitions of the program. Note that there may be free variables in these expressions.

OCaml

Innovation. Community. Security.