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

type marked_expr = expr Utils.Marked.pos

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

module ExprMap : Map.S with type key = expr

Variable helpers

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

Rules and scopes

type exception_situation =
  1. | BaseCase
  2. | ExceptionToLabel of LabelName.t Utils.Marked.pos
  3. | ExceptionToRule of RuleName.t Utils.Marked.pos
type label_situation =
  1. | ExplicitlyLabeled of LabelName.t Utils.Marked.pos
  2. | Unlabeled
type rule = {
  1. rule_id : RuleName.t;
  2. rule_just : expr Utils.Marked.pos Bindlib.box;
  3. rule_cons : expr Utils.Marked.pos Bindlib.box;
  4. rule_parameter : (Var.t * Scopelang.Ast.typ Utils.Marked.pos) option;
  5. rule_exception : exception_situation;
  6. rule_label : label_situation;
}
module Rule : Set.OrderedType with type t = rule
val empty_rule : Utils.Pos.t -> Scopelang.Ast.typ Utils.Marked.pos option -> rule
val always_false_rule : Utils.Pos.t -> Scopelang.Ast.typ Utils.Marked.pos 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.Marked.pos
  2. | VariesWith of unit * variation_typ Utils.Marked.pos option
type scope_def = {
  1. scope_def_rules : rule RuleMap.t;
  2. scope_def_typ : Scopelang.Ast.typ Utils.Marked.pos;
  3. scope_def_is_condition : bool;
  4. scope_def_io : Scopelang.Ast.io;
}
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.Marked.pos -> LocationSet.t
val free_variables : rule RuleMap.t -> Utils.Pos.t ScopeDefMap.t
OCaml

Innovation. Community. Security.