package catala

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

Abstract syntax tree for the lambda calculus

Abstract syntax tree

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

type lit =
  1. | LBool of bool
  2. | LInt of Runtime.integer
  3. | LRat of Runtime.decimal
  4. | LMoney of Runtime.money
  5. | LUnit
  6. | LDate of Runtime.date
  7. | LDuration of Runtime.duration
type except =
  1. | ConflictError
  2. | EmptyError
  3. | NoValueProvided
  4. | Crash
type expr =
  1. | EVar of expr Bindlib.var Utils.Pos.marked
  2. | ETuple of expr Utils.Pos.marked list * Dcalc.Ast.StructName.t option
    (*

    The MarkedString.info is the former struct field name

    *)
  3. | ETupleAccess of expr Utils.Pos.marked * int * Dcalc.Ast.StructName.t option * Dcalc.Ast.typ Utils.Pos.marked list
    (*

    The MarkedString.info is the former struct field name

    *)
  4. | EInj of expr Utils.Pos.marked * int * Dcalc.Ast.EnumName.t * Dcalc.Ast.typ Utils.Pos.marked list
    (*

    The MarkedString.info is the former enum case name

    *)
  5. | EMatch of expr Utils.Pos.marked * expr Utils.Pos.marked list * Dcalc.Ast.EnumName.t
    (*

    The MarkedString.info is the former enum case name

    *)
  6. | EArray of expr Utils.Pos.marked list
  7. | ELit of lit
  8. | EAbs of (expr, expr Utils.Pos.marked) Bindlib.mbinder Utils.Pos.marked * Dcalc.Ast.typ Utils.Pos.marked list
  9. | EApp of expr Utils.Pos.marked * expr Utils.Pos.marked list
  10. | EAssert of expr Utils.Pos.marked
  11. | EOp of Dcalc.Ast.operator
  12. | EIfThenElse of expr Utils.Pos.marked * expr Utils.Pos.marked * expr Utils.Pos.marked
  13. | ERaise of except
  14. | ECatch of expr Utils.Pos.marked * except * expr Utils.Pos.marked

Variable helpers

module Var : sig ... end
module VarMap : Map.S with type key = Var.t
type vars = expr Bindlib.mvar
val option_enum : Dcalc.Ast.EnumName.t
val none_constr : Dcalc.Ast.EnumConstructor.t
val some_constr : Dcalc.Ast.EnumConstructor.t

e' = make_matchopt'' pos v e e_none e_some Builds the term corresponding to match e with | None -> fun () -> e_none |Some -> fun v -> e_some.

val handle_default : Var.t
val handle_default_opt : Var.t
type scope_body = {
  1. scope_body_name : Dcalc.Ast.ScopeName.t;
  2. scope_body_var : Var.t;
  3. scope_body_expr : expr Utils.Pos.marked;
}
type program = {
  1. decl_ctx : Dcalc.Ast.decl_ctx;
  2. scopes : scope_body list;
}