In the desugared representation or in the 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 Catala_utils.Uid
module provides a generative functor whose output is a fresh sort of global identifiers.
Related modules:
Catala_utils.Uid
Global identifiers factories using a generative functorThis 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.
The positions also include attribute information, as an extensible variant defined in the same module.
Related modules:
Catala_utils.Pos
Source code positionError 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 Catala_utils.Message
Related modules:
Catala_utils.Message
Interface for emitting compiler messages.Throughout we use values with a "mark", which most often contains position information, or more in the case of AST nodes. Such values are simply pairs payload, mark
, but the following module provides some helper to work with them (e.g. to do mark-agnostic comparisons).
Related modules:
Catala_utils.Mark
AST node annotations (used for position, type, etc.)For some global flags, like the debug option, having a global reference is more convenient than passing the information everywhere. This is all gathered in the single global value Global.options
(and forbidden in other modules).
Related modules:
Catala_utils.Global
This module contains definitions of global flags and types used throughout. They should be defined from the command-line and never modified afterwards.The Map
module is an overlay on the OCaml stdlib Map
that provides some extensions and convenience functions.
Note of warning: the Not_found
exception is specialised for every instance of the functor. This is useful to automatically report what element was not found, but be careful with catching Stdlib.Not_found
, which won't work.
Related modules:
Catala_utils.Map
Small wrapper on top of the stdlib Map
module to add some useful functionsRelated modules:
Catala_utils.File
Catala_utils.Cli
Catala_utils.String
Catala_utils.Suggestions
Catala_utils.Graphs
Catala_utils.Hash
Hashes for the identification of modules.Catala_utils.Version
The implementation of this module is generated by the build system (through get_version.ml
), and should only contain a static string