package catala

  1. Overview
  2. Docs

Abstract syntax tree of the desugared representation

module Pos = Utils.Pos
module Uid = Utils.Uid

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 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

type rule = {
  1. just : Scopelang.Ast.expr Pos.marked Bindlib.box;
  2. cons : Scopelang.Ast.expr Pos.marked Bindlib.box;
  3. parameter : (Scopelang.Ast.Var.t * Scopelang.Ast.typ Pos.marked) option;
  4. exception_to_rule : RuleName.t option;
}
val empty_rule : Pos.t -> Scopelang.Ast.typ Pos.marked option -> rule
type assertion = Scopelang.Ast.expr 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 Pos.marked
  2. | VariesWith of unit * variation_typ Pos.marked option
type scope = {
  1. scope_vars : Scopelang.Ast.ScopeVarSet.t;
  2. scope_sub_scopes : Scopelang.Ast.ScopeName.t Scopelang.Ast.SubScopeMap.t;
  3. scope_uid : Scopelang.Ast.ScopeName.t;
  4. scope_defs : (rule RuleMap.t * Scopelang.Ast.typ Pos.marked) 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 free_variables : rule RuleMap.t -> Pos.t ScopeDefMap.t
OCaml

Innovation. Community. Security.