package catala

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

Install

dune-project
 Dependency

Authors

Maintainers

Sources

1.0.0-alpha.tar.gz
md5=2615968670ac21b1d00386a9b04b3843
sha512=eff292fdd75012f26ce7b17020f5a8374eef37cd4dd6ba60338dfbe89fbcad3443d1b409e44c182b740da9f58dff7e76dcb8ddefe47f9b2b160666d1c6930143

doc/dcalc.html

Default calculus

This representation is the fourth in the compilation chain (see Architecture). Its main difference with the previous desugared representation is that scopes have been lowered into regular functions. The default calculus can be later compiled to a lambda calculus.

The module describing the abstract syntax tree is Dcalc.Ast. This intermediate representation corresponds to the default calculus presented in the Catala formalization.

Translation from the scope language

The translation from the scope language to the default calculus involves three big features:

  • Handle the transformation of context variables (in particular, functions)
  • Build signatures for the scopes as functions
  • Transform the list of scopes into a program

The last point is based on the inter-scope dependency carried out on the scope language by Scopelang.Dependency.

Related modules:

Invariants

While Dcalc is a superset of a fully-fledged simply typed lambda calculus, the Dcalc code actually generated from the previous intermediate representation obeys some strict structural invariants. Those are formalized and empirically tested in Dcalc.Invariants.

Related modules:

  • Dcalc.Invariants This file makes explicit few structural invariants of the dcalc asbtract syntax tree. Those invariants have been checked on all tests and examples of catala. The behavior of the compiler on programs that don't follow those invariant in undefined.

Autotest

This module runs the interpreter on annotated test scopes, and inserts additional assertions that the results match the obtained results into the program.

Related modules:

  • Dcalc.Autotest This module scans a program for "test" scopes, detected as scopes without any undefined inputs. It runs the interpreter to compute their results, then inserts assertion in the code that ensure correctness of said results.