package catala
Install
Dune Dependency
Authors
Maintainers
Sources
md5=8f891209d18b6540df9c34b2d1a6a783
sha512=737770b87a057674bceefe77e8526720732552f51f424afcebcb6a628267eab522c4fd993caca1ae8ed7ace65a4a87e485af10c1676e51ca5939509a1b841ac2
doc/lcalc.html
Lambda calculus
This representation is the fifth in the compilation chain (see Architecture). Its main difference with the previous default calculus is the absence of the default term, which has been eliminated through diverse compilation schemes.
The module describing the abstract syntax tree is:
Lcalc.Ast
Abstract syntax tree for the lambda calculus
This intermediate representation corresponds to the lambda calculus presented in the Catala formalization.
Compilation from default calculus
Lcalc.Compile_with_exceptions
compiles the default term of the default calculus using catchable exceptions. This compilation scheme has been certified. Another compilation scheme that uses an option monad instead is available at Lcalc.Compile_without_exceptions
.
Related modules:
Lcalc.Compile_with_exceptions
Translation from the default calculus to the lambda calculus. This translation uses exceptions to handle empty default terms.Lcalc.Compile_without_exceptions
Translation from the default calculus to the lambda calculus. This translation uses an option monad to handle empty defaults terms. This transformation is one piece to permit to compile toward legacy languages that does not contains exceptions.
Closure conversion
To target languages that don't have support for closures, we need to convert the closures to first-class functions in function-pointer-passing style computations.
Lcalc.Closure_conversion
This module performs environment-passing style closure conversion, relying on the existentialTClosureEnv
type and tuples for closure environments. The implementation is based on François Pottier's MPRI lesson. After closure conversion, closure hoisting is perform and all closures end up as toplevel definitions.
Backends
The OCaml backend of the lambda calculus is merely a syntactic formatting, since the core of the OCaml value language is effectively a lambda calculus.
Related modules:
Lcalc.To_ocaml
Formats a lambda calculus program into a valid OCaml program