package catala
Install
Dune Dependency
Authors
Maintainers
Sources
md5=b22e238d5d5c8452067109e9c7c0f427
sha512=ccc8c557c67c2f9d1bed4b957b2367f0f6afc0ef9b8b83237cf2a2912b3e8829b7e8af78ea7fe00b20ecf28b436ad04b591e5fff4f82fd08725d40a18c9924d0
doc/scopelang.html
The scope language
This representation is the third in the compilation chain (see Architecture). Its main difference with the previous desugared representation is that inside a scope, the definitions are ordered according to their computational dependency order, and each definition is a Dcalc.Ast.expr.EDefault
tree instead of a flat list of rules.
The module describing the abstract syntax tree is:
Scopelang.Ast
Abstract syntax tree of the scope language
Printing helpers can be found in Scopelang.Print
.
This intermediate representation corresponds to the scope language presented in the Catala formalization.
Translation to the default calculus
The translation from the scope language to the default calculus involves three big features:
- Translating structures and enums into simpler sum and product types
- Build thunked signatures for the scopes as functions
- Transform the list of scopes into a program
1 and 3 involve computing dependency graphs for respectively the structs and enums on one hand, and the inter-scope dependencies on the other hand. Both can be found in Scopelang.Dependency
, while Scopelang.Scope_to_dcalc
is mostly responsible for 2.
Related modules:
Scopelang.Dependency
Graph representation of the dependencies between scopes in the Catala program. Vertices are functions, x -> y if x is used in the definition of y.Scopelang.Scope_to_dcalc
Scope language to default calculus translator