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:

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:

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: