mirror of
https://github.com/CatalaLang/catala.git
synced 2024-11-08 07:51:43 +03:00
40 lines
1.4 KiB
Plaintext
40 lines
1.4 KiB
Plaintext
{0 The scope language }
|
|
|
|
This representation is the third in the compilation chain
|
|
(see {{: index.html#architecture} Architecture}). Its main difference
|
|
with the previous {{: desugared.html} desugared representation} is that inside
|
|
a scope, the definitions are ordered according to their computational
|
|
dependency order, and each definition is a {!Shared_ast.EDefault} tree
|
|
instead of a flat list of rules.
|
|
|
|
The module describing the abstract syntax tree is:
|
|
|
|
{!modules: Scopelang.Ast}
|
|
|
|
Printing helpers can be found in {!module: Scopelang.Print}.
|
|
|
|
This intermediate representation corresponds to the scope language
|
|
presented in the {{: https://github.com/CatalaLang/catala/raw/master/doc/formalization/formalization.pdf}
|
|
Catala formalization}.
|
|
|
|
{1 Translation to the default calculus}
|
|
|
|
The translation from the scope language to the
|
|
{{: dcalc.html} default calculus} involves three big features:
|
|
|
|
{ol
|
|
{li Translating structures and enums into simpler sum and product types}
|
|
{li Build thunked signatures for the scopes as functions }
|
|
{li 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 {!module:Scopelang.Dependency}, while {!module:Dcalc.From_scopelang}
|
|
is mostly responsible for 2.
|
|
|
|
|
|
Related modules:
|
|
|
|
{!modules: Scopelang.Dependency Dcalc.From_scopelang}
|