2020-12-14 20:09:38 +03:00
|
|
|
{0 Compiler utilities}
|
|
|
|
|
|
|
|
{1 Unique identifiers}
|
|
|
|
|
2022-01-19 12:54:16 +03:00
|
|
|
In {{: desugared.html} the desugared representation} or in the
|
|
|
|
{{: scopelang.html} the scope language}, a number of things are named using
|
|
|
|
global identifiers. These identifiers use OCaml's type system to statically
|
|
|
|
distinguish e.g. a scope identifier from a struct identifier.
|
2020-12-14 20:09:38 +03:00
|
|
|
|
2023-06-02 18:17:45 +03:00
|
|
|
The {!module:Catala_utils.Uid} module provides a generative functor whose output is
|
2022-01-19 12:54:16 +03:00
|
|
|
a fresh sort of global identifiers.
|
2020-12-14 20:09:38 +03:00
|
|
|
|
2022-01-19 12:54:16 +03:00
|
|
|
Related modules:
|
2020-12-14 20:09:38 +03:00
|
|
|
|
2023-06-02 18:17:45 +03:00
|
|
|
{!modules: Catala_utils.Uid}
|
2020-12-14 20:09:38 +03:00
|
|
|
|
|
|
|
{1 Source code positions}
|
|
|
|
|
2022-01-19 12:54:16 +03:00
|
|
|
This module is used throughout the compiler to annotate the abstract syntax
|
|
|
|
trees with information about the position of the element in the original source
|
|
|
|
code. These annotations are critical to produce readable error messages.
|
|
|
|
|
2020-12-14 20:09:38 +03:00
|
|
|
Related modules:
|
|
|
|
|
2023-06-02 18:17:45 +03:00
|
|
|
{!modules: Catala_utils.Pos}
|
2020-12-14 20:09:38 +03:00
|
|
|
|
|
|
|
{1 Error messages}
|
|
|
|
|
|
|
|
Error handling is critical in a compiler. The Catala compiler uses an architecture
|
2022-01-19 12:54:16 +03:00
|
|
|
of error messages inspired by the Rust compiler, where error messages all
|
|
|
|
correspond to the same exception. This exception carries messages and positions
|
|
|
|
that are displayed in the end in a nicely-formatted error message.
|
2020-12-14 20:09:38 +03:00
|
|
|
|
2023-06-02 18:17:45 +03:00
|
|
|
Hence, all error thrown by the compiler should use {!module:Catala_utils.Messages}
|
2022-01-19 12:54:16 +03:00
|
|
|
|
|
|
|
Related modules:
|
|
|
|
|
2023-06-02 18:17:45 +03:00
|
|
|
{!modules: Catala_utils.Messages}
|
2022-05-18 16:10:59 +03:00
|
|
|
|
2022-08-05 19:33:32 +03:00
|
|
|
{1 Other utilies}
|
2022-05-18 16:10:59 +03:00
|
|
|
|
|
|
|
Related modules:
|
|
|
|
|
2023-06-02 18:17:45 +03:00
|
|
|
{!modules: Catala_utils.File Catala_utils.Mark Catala_utils.Cli Catala_utils.String}
|