catala/compiler/scopelang/scopelang.mld

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

40 lines
1.4 KiB
Plaintext
Raw Normal View History

2020-12-14 19:00:42 +03:00
{0 The scope language }
This representation is the third in the compilation chain
(see {{: index.html#architecture} Architecture}). Its main difference
2020-12-14 19:00:42 +03:00
with the previous {{: desugared.html} desugared representation} is that inside
a scope, the definitions are ordered according to their computational
2023-06-02 18:17:45 +03:00
dependency order, and each definition is a {!Shared_ast.EDefault} tree
2020-12-14 19:00:42 +03:00
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
2020-12-14 20:09:38 +03:00
presented in the {{: https://github.com/CatalaLang/catala/raw/master/doc/formalization/formalization.pdf}
Catala formalization}.
2020-12-14 19:00:42 +03:00
{1 Translation to the default calculus}
The translation from the scope language to the
2020-12-14 19:00:42 +03:00
{{: 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
2023-06-02 18:17:45 +03:00
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.
2022-01-19 12:54:16 +03:00
Related modules:
2023-06-02 18:17:45 +03:00
{!modules: Scopelang.Dependency Dcalc.From_scopelang}