package catala

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

Abstract syntax tree of the desugared representation

Names, Maps and Keys

module IdentMap : Map.S with type key = String.t
module RuleMap : Map.S with type key = RuleName.t
module RuleSet : Set.S with type elt = RuleName.t
module LabelMap : Map.S with type key = LabelName.t
module LabelSet : Set.S with type elt = LabelName.t
module ScopeVarSet : Set.S with type elt = ScopeVar.t
module ScopeVarMap : Map.S with type key = ScopeVar.t
module ScopeDef : sig ... end

Inside a scope, a definition can refer either to a scope def, or a subscope def

module ScopeDefMap : Map.S with type key = ScopeDef.t
module ScopeDefSet : Set.S with type elt = ScopeDef.t

AST

Variable helpers

module Var : sig ... end
module VarMap : Map.S with type key = Var.t
type vars = expr Bindlib.mvar

Rules and scopes

type rule = {
  1. rule_id : RuleName.t;
  2. rule_just : expr Utils.Pos.marked Bindlib.box;
  3. rule_cons : expr Utils.Pos.marked Bindlib.box;
  4. rule_parameter : (Var.t * Scopelang.Ast.typ Utils.Pos.marked) option;
  5. rule_exception_to_rules : RuleSet.t Utils.Pos.marked;
}
val empty_rule : Utils.Pos.t -> Scopelang.Ast.typ Utils.Pos.marked option -> rule
val always_false_rule : Utils.Pos.t -> Scopelang.Ast.typ Utils.Pos.marked option -> rule
type variation_typ =
  1. | Increasing
  2. | Decreasing
type reference_typ =
  1. | Decree
  2. | Law
type meta_assertion =
  1. | FixedBy of reference_typ Utils.Pos.marked
  2. | VariesWith of unit * variation_typ Utils.Pos.marked option
type scope_def = {
  1. scope_def_rules : rule RuleMap.t;
  2. scope_def_typ : Scopelang.Ast.typ Utils.Pos.marked;
  3. scope_def_is_condition : bool;
  4. scope_def_io : Scopelang.Ast.io;
  5. scope_def_label_groups : RuleSet.t LabelMap.t;
}
type var_or_states =
  1. | WholeVar
  2. | States of StateName.t list
type scope = {
  1. scope_vars : var_or_states ScopeVarMap.t;
  2. scope_sub_scopes : Scopelang.Ast.ScopeName.t Scopelang.Ast.SubScopeMap.t;
  3. scope_uid : Scopelang.Ast.ScopeName.t;
  4. scope_defs : scope_def ScopeDefMap.t;
  5. scope_assertions : assertion list;
  6. scope_meta_assertions : meta_assertion list;
}
type program = {
  1. program_scopes : scope Scopelang.Ast.ScopeMap.t;
  2. program_enums : Scopelang.Ast.enum_ctx;
  3. program_structs : Scopelang.Ast.struct_ctx;
}

Helpers

val locations_used : expr Utils.Pos.marked -> LocationSet.t
val free_variables : rule RuleMap.t -> Utils.Pos.t ScopeDefMap.t