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 : Stdlib.Map.S with type key = Stdlib.String.t
module RuleMap : Stdlib.Map.S with type key = RuleName.t
module RuleSet : Stdlib.Set.S with type elt = RuleName.t
module LabelMap : Stdlib.Map.S with type key = LabelName.t
module LabelSet : Stdlib.Set.S with type elt = LabelName.t
module ScopeVarSet : Stdlib.Set.S with type elt = ScopeVar.t
module ScopeVarMap : Stdlib.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 : Stdlib.Map.S with type key = ScopeDef.t
module ScopeDefSet : Stdlib.Set.S with type elt = ScopeDef.t

AST

module LocationSet : Stdlib.Set.S with type elt = location Utils.Pos.marked

The expressions use the Bindlib library, based on higher-order abstract syntax

Variable helpers

module Var : sig ... end
module VarMap : Stdlib.Map.S with type key = Var.t
type vars = expr Bindlib.mvar
val make_var : Var.t Utils.Pos.marked -> expr Utils.Pos.marked Bindlib.box
val make_abs : vars -> expr Utils.Pos.marked Bindlib.box -> Utils.Pos.t -> Scopelang.Ast.typ Utils.Pos.marked list -> Utils.Pos.t -> expr Utils.Pos.marked Bindlib.box
val make_app : expr Utils.Pos.marked Bindlib.box -> expr Utils.Pos.marked Bindlib.box list -> Utils.Pos.t -> expr Utils.Pos.marked Bindlib.box
val make_let_in : Var.t -> Scopelang.Ast.typ Utils.Pos.marked -> expr Utils.Pos.marked Bindlib.box -> expr Utils.Pos.marked Bindlib.box -> expr Utils.Pos.marked Bindlib.box

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 assertion = expr Utils.Pos.marked Bindlib.box
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
OCaml

Innovation. Community. Security.