catala/compiler/catala_utils/catala_utils.mld
2022-11-28 16:38:09 +01:00

45 lines
1.3 KiB
Plaintext

{0 Compiler utilities}
{1 Unique identifiers}
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.
The {!module: Uid} module provides a generative functor whose output is
a fresh sort of global identifiers.
Related modules:
{!modules: Uid}
{1 Source code positions}
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.
Related modules:
{!modules: Pos}
{1 Error messages}
Error handling is critical in a compiler. The Catala compiler uses an architecture
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.
Hence, all error thrown by the compiler should use {!module: Utils.Errors}
Related modules:
{!modules: Utils.Errors}
{1 Other utilies}
Related modules:
{!modules: Utils.File Utils.String_common}