package catala
Install
Dune Dependency
Authors
Maintainers
Sources
md5=b22e238d5d5c8452067109e9c7c0f427
sha512=ccc8c557c67c2f9d1bed4b957b2367f0f6afc0ef9b8b83237cf2a2912b3e8829b7e8af78ea7fe00b20ecf28b436ad04b591e5fff4f82fd08725d40a18c9924d0
doc/utils.html
Compiler utilities
Unique identifiers
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 Utils.Uid
module provides a generative functor whose output is a fresh sort of global identifiers.
Related modules:
Utils.Uid
Global identifiers factories using a generative functor
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:
Utils.Pos
Source code position
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 Utils.Errors
Related modules:
Utils.Errors
Error formatting and helper functions