package catala

  1. Overview
  2. Docs

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. | 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 Utils.Pos.t * (expr, expr Utils.Pos.marked) Bindlib.mbinder * 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 : 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 -> Dcalc.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 -> Dcalc.Ast.typ Utils.Pos.marked -> expr Utils.Pos.marked Bindlib.box -> expr Utils.Pos.marked Bindlib.box -> expr Utils.Pos.marked Bindlib.box
type binder = (expr, expr Utils.Pos.marked) Bindlib.binder
type program = {
  1. decl_ctx : Dcalc.Ast.decl_ctx;
  2. scopes : (Var.t * expr Utils.Pos.marked) list;
}
OCaml

Innovation. Community. Security.