catala/compiler/catala_utils
Louis Gesbert b9156bb60e Implement safe renaming of idents for backend printing
Previously we had some heuristics in the backends trying to achieve this with a
lot of holes ; this should be much more solid, relying on `Bindlib` to do the
correct renamings.

**Note1**: it's not plugged into the backends other than OCaml at the moment.

**Note2**: the related, obsolete heuristics haven't been cleaned out yet

**Note3**: we conservatively suppose a single namespace at the moment. This is
required for e.g. Python, but it forces vars named like struct fields to be
renamed, which is more verbose in e.g. OCaml. The renaming engine could be
improved to support different namespaces, with a way to select how to route the
different kinds of identifiers into them.

Similarly, customisation for what needs to be uppercase or lowercase is not
available yet.

**Note4**: besides excluding keywords, we should also be careful to exclude (or
namespace):
- the idents used in the runtime (e.g. `o_add_int_int`)
- the dynamically generated idents (e.g. `embed_*`)

**Note5**: module names themselves aren't handled yet. The reason is that they
must be discoverable by the user, and even need to match the filenames, etc. In
other words, imagine that `Mod` is a keyword in the target language. You can't
rename a module called `Mod` to `Mod1` without knowing the whole module context,
because that would destroy the mapping for a module already called `Mod1`.

A reliable solution would be to translate all module names to e.g.
`CatalaModule_*`, which we can assume will never conflict with any built-in, and
forbid idents starting with that prefix. We may also want to restrict their
names to ASCII ? Currently we use a projection, but what if I have two modules
called `Là` and `La` ?
2024-08-28 17:18:26 +02:00
..
catala_utils.mld Match the compiler code to the new type of error message content 2023-07-12 11:55:11 +02:00
cli.ml Remove the with-exceptions backend 2024-07-04 15:08:13 +02:00
cli.mli Remove the with-exceptions backend 2024-07-04 15:08:13 +02:00
dune Messages: adjust to terminal width 2024-04-26 15:40:55 +02:00
file.ml Support for basic clerk.toml configuration files (#639) 2024-07-01 15:40:06 +02:00
file.mli Clerk: add support for basic configuration files 2024-06-26 10:41:12 +02:00
get_version.ml Better version handling 2024-01-24 11:41:34 +01:00
global.ml Add an option to stop on the first delayed error encountered 2024-06-19 14:52:32 +02:00
global.mli Add an option to stop on the first delayed error encountered 2024-06-19 14:52:32 +02:00
hash.ml Remove the with-exceptions backend 2024-07-04 15:08:13 +02:00
hash.mli Remove the with-exceptions backend 2024-07-04 15:08:13 +02:00
map.ml Reformat 2023-11-30 23:53:38 +01:00
mark.ml Computation and checking of module hashes 2024-05-28 11:43:50 +02:00
mark.mli Computation and checking of module hashes 2024-05-28 11:43:50 +02:00
message.ml fix typing error missing position 2024-08-06 16:17:43 +02:00
message.mli add lsp error notification mechanism 2024-07-31 12:13:49 +02:00
pos.ml fix position invalid test 2024-07-31 14:01:56 +02:00
pos.mli Messages: improve string padding processing 2024-06-19 16:10:26 +02:00
string.ml Clerk reports: postprocess diff output 2024-06-21 18:19:09 +02:00
string.mli Clerk reports: postprocess diff output 2024-06-21 18:19:09 +02:00
suggestions.ml Refactor and improve suggestions' pretty-printing 2024-06-21 11:11:53 +02:00
suggestions.mli Refactor suggestions 2024-06-20 15:59:54 +02:00
uid.ml Fix hashing of submodule references 2024-05-28 11:43:50 +02:00
uid.mli Implement safe renaming of idents for backend printing 2024-08-28 17:18:26 +02:00
version.mli Better version handling 2024-01-24 11:41:34 +01:00