package catala

  1. Overview
  2. Docs
Compiler and library for the literate programming language for tax code specification

Install

Dune Dependency

Authors

Maintainers

Sources

0.7.0.tar.gz
md5=6dbbc2f50c23693f26ab6f048e78172f
sha512=a5701e14932d8a866e2aa3731f76df85ff2a68b4fa943fd510c535913573274d66eaec1ae6fcae17f20b475876048a9ab196ef6d8c23d4ea6b90b986aa0a6daa

doc/index.html

The Catala compiler

Architecture

The architecture of the Catala compiler is inspired by CompCert or the Nanopass framework, and is structured around many intermediate representations connected by successive translations passes.

Here is the recap picture of the different intermediate representations of the Catala compiler (made with an ASCII diagram tool):

                                     +---------------+
                                     |               |
                                     |  Surface AST  |
                                     |               |
                                     +---------------+
                                             |
                                             |
         * Separate code from legislation    |
         * Remove syntactic sugars           |
                                             v
                                   +------------------+
                                   |                  |
                                   |  Desugared AST   |
                                   |                  |
                                   +------------------+
                                             |
                                             |
 * Build rule trees for each definition      |
 * Order variable computations inside scope  |
                                             v
                                  +--------------------+
                                  |                    |
                                  | Scope language AST |
                                  |                    |
                                  +--------------------+
                                             |
                                             |
        * Convert scopes into functions      |
        * Thunking of subscope arguments     |
                                             |
                                             v
                                 +----------------------+
                                 |                      |
                                 | Default calculus AST |
                                 |                      |
                                 +----------------------+
                                             |
                                             |
                                             |
       * Compile the default term            |
                                             |
                                             v
                                 +----------------------+
                                 |                      |
                                 | Lambda calculus AST  |
                                 |                      |
                                 +----------------------+
                                             |
                                             |
        * Turn expressions into statements   |
                                             |
                                             v
                               +--------------------------+
                               |                          |
                               |  Statement calculus AST  |
                               |                          |
                               +--------------------------+

List of top-level modules

Each of those intermediate representation is bundled into its own dune bundle module. Click on the items below if you want to dive straight into the signatures.

More documentation can be found on each intermediate representations here.

The main compilation chain is defined in:

Additionally, the compiler features a verification plugin that generates verification condition for proof backends. More information can be found here:

Two more modules contain additional features for the compiler:

The Catala runtimes documentation is available here:

Last, it is possible to customize the backend to the compiler using a plugin mechanism. The API is defined inside the following module:

See the examples in the plugins/ subdirectory:

OCaml

Innovation. Community. Security.