catala/compiler/index.mld

90 lines
3.6 KiB
Plaintext
Raw Normal View History

2020-12-14 17:23:04 +03:00
{0 The Catala compiler}
{1 Architecture}
2021-03-19 19:49:56 +03:00
The architecture of the Catala compiler is inspired by
2020-12-14 17:23:04 +03:00
{{: https://compcert.org/} CompCert} or the {{: https://nanopass.org/} Nanopass}
2021-03-19 19:49:56 +03:00
framework, and is structured around many intermediate representations connected
2020-12-14 17:23:04 +03:00
by successive translations passes.
2021-03-19 19:49:56 +03:00
Here is the recap picture of the different intermediate representations of the
2020-12-14 17:23:04 +03:00
Catala compiler (made with an {{: https://textik.com/#c1c1fecda5209492} ASCII diagram tool}):
2021-03-19 19:49:56 +03:00
{v
+---------------+
| |
| Surface AST |
| |
+---------------+
|
|
* Separate code from legislation |
* Remove syntactic sugars |
v
+---------------+
| |
| Desugared AST |
| |
+---------------+
|
|
* Build rule trees for each definition |
* Order variable computations inside scope |
v
+--------------------+
| |
| Scope language AST |
| |
+--------------------+
|
|
* Convert scopes into functions |
* Thunking of subscope arguments |
|
v
2020-12-14 17:23:04 +03:00
+----------------------+
| |
| Default calculus AST |
| |
2021-03-19 19:49:56 +03:00
+----------------------+
|
|
|
* Compile the default term |
|
v
+----------------------+
| |
| Lambda calculus AST |
| |
+----------------------+
v}
2020-12-14 17:23:04 +03:00
{1 List of top-level modules }
2021-03-19 19:49:56 +03:00
Each of those intermediate representation is bundled into its own `dune` bundle
2020-12-14 17:23:04 +03:00
module. Click on the items below if you want to dive straight into the signatures.
2021-03-19 19:49:56 +03:00
{!modules: Surface Desugared Scopelang Dcalc Lcalc }
2020-12-14 17:23:04 +03:00
More documentation can be found on each intermediate representations here.
2021-03-19 19:49:56 +03:00
{ul
2020-12-14 17:23:04 +03:00
{li {{: surface.html} The surface representation}}
{li {{: desugared.html} The desugared representation}}
{li {{: scopelang.html} The scope language }}
{li {{: dcalc.html} The default calculus}}
2021-03-19 19:49:56 +03:00
{li {{: lcalc.html} The lambda calculus}}
2020-12-14 17:23:04 +03:00
}
2020-12-14 20:09:38 +03:00
The main compilation chain is defined in:
2021-04-22 12:57:50 +03:00
{!modules: Driver}
2020-12-14 20:09:38 +03:00
2020-12-14 17:23:04 +03:00
Last, two more modules contain additional features for the compiler:
2020-12-14 20:09:38 +03:00
{ul
{li {{: literate.html} Literate programming}}
{li {{: utils.html} Compiler utilities}}
2021-04-22 12:57:50 +03:00
}