package catala
Install
dune-project
Dependency
Authors
Maintainers
Sources
md5=41b0317af37925b16ae7aedfddbcc8b4
sha512=f02c4e4c7d8ca92c4c2100d1dfc31c56218a8fae3760135335c9cdd10d9edbeb6eb5e407b430c095f579ce2226c3fe4c314788af5aa35c37d04e4dee5f459cb8
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.EDefault tree instead of a flat list of rules.
The module describing the abstract syntax tree is:
Scopelang.AstAbstract 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
Related modules:
Scopelang.DependencyGraph 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
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.