catala/compiler/dcalc/dcalc.mld

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

49 lines
1.6 KiB
Plaintext
Raw Normal View History

2020-12-14 20:09:38 +03:00
{0 Default calculus}
2021-03-19 19:49:56 +03:00
This representation is the fourth in the compilation chain
(see {{: index.html#architecture} Architecture}). Its main difference
with the previous {{: desugared.html} desugared representation} is that scopes
2020-12-14 20:09:38 +03:00
have been lowered into regular functions, and enums and structs have been
2021-03-19 19:49:56 +03:00
lowered to sum and product types. The default calculus can be later compiled
to a {{: lcalc.html} lambda calculus}.
2020-12-14 20:09:38 +03:00
2022-01-19 12:54:16 +03:00
The module describing the abstract syntax tree is {!module: Dcalc.Ast}.
2020-12-14 20:09:38 +03:00
Printing helpers can be found in {!module: Dcalc.Print}.
2021-03-19 19:49:56 +03:00
This intermediate representation corresponds to the default calculus
presented in the {{: https://arxiv.org/abs/2103.03198} Catala formalization}.
2020-12-14 20:09:38 +03:00
Related modules:
2022-01-19 12:54:16 +03:00
{!modules: Dcalc.Ast}
{1 Typing }
2020-12-14 20:09:38 +03:00
This representation is where the typing is performed. Indeed, {!module: Dcalc.Typing}
implements the classical {{: https://en.wikipedia.org/wiki/Hindley%E2%80%93Milner_type_system} W algorithm}
corresponding to a Hindley-Milner type system, without type constraints.
Related modules:
2022-01-19 12:54:16 +03:00
{!modules: Dcalc.Typing}
{1 Interpreter}
2020-12-14 20:09:38 +03:00
Since this representation is currently the last of the compilation chain,
an {!module: Dcalc.Interpreter} module is provided to match the execution
2021-03-19 19:49:56 +03:00
semantics of the default calculus.
2020-12-14 20:09:38 +03:00
2021-03-19 19:49:56 +03:00
Later, translations to a regular lambda calculus and/or a simple imperative
2022-01-19 12:54:16 +03:00
language are bound to be added.
Related modules:
{!modules: Dcalc.Interpreter}
{1 Optimizations}
Classical optimizations passes can be performed on the Dcalc AST: partial
evaluation, beta and iota-reduction, etc.
Related modules:
{!modules: Dcalc.Optimizations}