package catala
Install
Dune Dependency
Authors
Maintainers
Sources
md5=6dbbc2f50c23693f26ab6f048e78172f
sha512=a5701e14932d8a866e2aa3731f76df85ff2a68b4fa943fd510c535913573274d66eaec1ae6fcae17f20b475876048a9ab196ef6d8c23d4ea6b90b986aa0a6daa
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
Other utilies
Related modules:
Utils.File
Utility functions used for file manipulation.Utils.String_common
Helper functions used for string manipulation.