package catala
Install
Dune Dependency
Authors
Maintainers
Sources
md5=4c6f725ef4d21c5ff91f60d74b454ef7
sha512=98806e03daa6f33740b80a0f78a37320fb70ebea8cb927ea8fed022673459189c32e2389ccba0fa25d93f754b0fa0128a5ee28e1bb9abefa330deb4be8cc7d95
doc/utils.html
Compiler utilities
Unique identifiers
Related modules:
Utils.Uid
Global identifiers factories using a generative functor
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.
Source code positions
Related modules:
Utils.Pos
Source code position
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.
Error messages
Related modules:
Utils.Errors
Error formatting and helper functions
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