Commit Graph

4151 Commits

Author SHA1 Message Date
Louis Gesbert
e9abbf9bd8 Scalc change: switch only on variables
matches can bind, but switches cannot, so we can assume the switch argument
should always be bound to a name ; this allow the intermediate variable to be
better renamed.
2024-08-28 18:12:32 +02:00
Louis Gesbert
14a378a33d Translation to scalc: fix renaming in blocks
Statements are often flattened, in which case their idents need to be
conflict-free. We pass along the renaming context to handle this.
2024-08-28 18:12:32 +02:00
Louis Gesbert
f565e84dae Restore special handling of the option enum in scalc backends
it's not very satisfying, but we make it pass through renaming for now. A better
approach could be to make this special handling structural, or to have something
more specific than an id to hold onto.
2024-08-28 18:12:32 +02:00
Louis Gesbert
081e07378a Renaming: move to its own module 2024-08-28 18:12:28 +02:00
Louis Gesbert
1b6da0b572 reformat (renaming in scalc) 2024-08-28 18:10:41 +02:00
Louis Gesbert
1230f787d6 Renaming: use in the scalc translation and in Python 2024-08-28 18:10:36 +02:00
Louis Gesbert
d23544de39 Apply suggestions from code review
Fix typos following review

Thanks @vincent-botbol

Co-authored-by: vbot <vincent.botbol@inria.fr>
2024-08-28 17:18:26 +02:00
Louis Gesbert
8b06511915 Renaming: more customisation
in particular, this avoids regression with reused struct fields getting renamed
with indices, which would have required changes in e.g.
`french_law/ocaml/bench.ml`
2024-08-28 17:18:26 +02:00
Louis Gesbert
acc13867bf Fix: return module items in file order
This affects their UIDs, and the order in which they later get traversed.

In particular, it was affecting the struct names renaming.
2024-08-28 17:18:26 +02:00
Louis Gesbert
dbfd05155b Fix: Expr.map was missing types in logs 2024-08-28 17:18:26 +02:00
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
Louis Gesbert
e83103ecf7 Update and fix CI
- alpine 3.20 fixed the latex packages we had trouble with (but added a new
  caveat, and has a missing libpng dependency)

- opam 2.2 was released which means we can finally simplify depext setup
  instructions, so we now use a local switch
2024-08-28 15:32:58 +02:00
Louis Gesbert
1d7b63523e
Introduce modules in toml config (#663) 2024-08-08 14:44:12 +02:00
vbot
f7f76e26ae
Improve error reporting and remove language 2024-08-06 18:12:29 +02:00
vbot
4b0967d3c5
Fix typing error missing position (#662) 2024-08-06 16:58:47 +02:00
vbot
9783eafb65
introduce modules in toml config files 2024-08-06 16:17:43 +02:00
vbot
e062124e47
fix typing error missing position 2024-08-06 16:17:43 +02:00
Louis Gesbert
89f64c7427
Fix missing keywords in emacs mode (#660) 2024-08-06 15:40:35 +02:00
Louis Gesbert
d7e444f491
Add LSP required features (#661) 2024-07-31 14:45:36 +02:00
vbot
f5b9e5df2d
fix position invalid test 2024-07-31 14:01:56 +02:00
vbot
9d5052147a
expose clerk_config as library 2024-07-31 14:01:55 +02:00
vbot
7f4824bed6
adapt existing errors to changes 2024-07-31 14:01:55 +02:00
vbot
c83e247d5d
add lsp error notification mechanism 2024-07-31 12:13:49 +02:00
Denis Merigoux
b80e453a2e We actually need sedlex=3.2 2024-07-31 11:02:03 +02:00
vbot
2006299956
fix missing keywords in emacs mode 2024-07-30 14:39:00 +02:00
vbot
475dca0766
Fix scopelang scope definition variable positions (#659) 2024-07-18 12:16:15 +02:00
vbot
2b8d6676d5
Scopelang: add list of definitions's positions to scope var def 2024-07-17 18:03:23 +02:00
vbot
d78f004848
Scopelang: fix scope definition incorrect position 2024-07-17 15:34:47 +02:00
Denis Merigoux
6e5e99a60a
Remove the R backend (#643) 2024-07-09 09:33:51 +02:00
Louis Gesbert
a7eec8fd72
Remove the "with-exceptions" backend from the compiler (#641) 2024-07-08 15:31:26 +02:00
Louis Gesbert
98a460e1b3 Remove the R backend
There are no users at the moment, so we won't be actively maintaining it.

If and when the need arises again, we can revert this commit and resurrect it.
2024-07-08 14:52:41 +02:00
Louis Gesbert
0b19130c1d Fix the Python printer 2024-07-08 14:52:41 +02:00
Louis Gesbert
97940c2cb6 Clerk report: better diff coloring 2024-07-08 14:52:28 +02:00
Louis Gesbert
7e97c19901 Cleanup leftover commented code bits 2024-07-08 10:12:42 +02:00
Louis Gesbert
ec6b50988b Fix bug in closure conversion 2024-07-05 18:03:01 +02:00
Louis Gesbert
961a93ae83 Small printer fix 2024-07-05 18:03:01 +02:00
Louis Gesbert
d4fc1afbb9 CI: it worked (almost) 2024-07-05 16:48:13 +02:00
Louis Gesbert
0031b3fc47 CI: fixing the last try 2024-07-05 15:48:45 +02:00
Louis Gesbert
30ab1961cc Still fixing CI (last try) 2024-07-05 15:43:20 +02:00
Louis Gesbert
0bfc2c5c30 Still fixing CI 2024-07-05 14:53:46 +02:00
Louis Gesbert
74da5888a5 Still fixing CI 2024-07-05 14:26:44 +02:00
Louis Gesbert
773fe0a956 CI: try another workaround 2024-07-04 18:02:01 +02:00
Louis Gesbert
3fafcb3782 Github CI: attempt a workaround 2024-07-04 16:15:35 +02:00
Louis Gesbert
6c601c41d5
Add JUnit-compatible test output to clerk report (#642) 2024-07-04 15:39:55 +02:00
Louis Gesbert
a5278244ec Debugging monomorphisation 2024-07-04 15:08:13 +02:00
Louis Gesbert
e78ea378bd Add clerk XML reports to Github 2024-07-04 15:08:13 +02:00
Louis Gesbert
03e74b505d Cleanup 2024-07-04 15:08:13 +02:00
Louis Gesbert
561788cbaf Fix formatting of debug timing markers 2024-07-04 15:08:13 +02:00
Louis Gesbert
88f5e932c8 Remove RaiseEmpty and CatchEmpty from the AST 2024-07-04 15:08:13 +02:00
Louis Gesbert
6cb19b4f0b Update relevant test results 2024-07-04 15:08:13 +02:00