Commit Graph

4111 Commits

Author SHA1 Message Date
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
a5278244ec Debugging monomorphisation 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
Louis Gesbert
e331c5b37c Interpreter: handle conversion to runtime of defaults//options
This case is really acrobatic, because we are interfacing code compiled to
OCaml (from lcalc) with code from dcalc, and the two have a different
representation for default terms. It... seems to work though.

A more reasonable solution, if there are problems with this or it reveals too
fragile, would be to enforce interpreting at the lcalc level as soon as you want
to link compiled modules.
2024-07-04 15:08:13 +02:00
Louis Gesbert
293bcd3817 Replace HandleDefault* internal operators by HandleExceptions
HandleExceptions only takes an array of exceptions, and returns Some if only one
of them is Some, None if they are all None, or raises a conflict error
otherwise.

The compilation of default terms then wraps this in a match (for the result of
HandleExceptions), and an if-then-else (for the justification-consequence in the
None case).

This avoids the complexity of having to handle thunked functions as arguments.
2024-07-04 15:08:13 +02:00
Louis Gesbert
b005652a85 Fix program printer flushing the ppf unnecessarily 2024-07-04 15:08:13 +02:00
Louis Gesbert
c3b978bef8 Remove the now unused HandleDefault operator
(we now only need HandleDefaultOpt)
2024-07-04 15:08:13 +02:00
Louis Gesbert
583e80993a Remove the with-exceptions backend
*Disclaimer*: This is intended for discussion

My impression is that the with-exceptions backend is to be superseded by the
without-exception backend, which is more general and more efficient. Therefore,
seeing the added complexity of maintaining the two in parallel, I see no good
reason to keep the with-exceptions version now that the equivalence of their
semantics have been proved.

It will also be nice to reduce divergences between the different backends ; and
this should make further simplifications possible (e.g. some thunkings may no
longer be needed)

Of course I am ready to hear arguments in favor of keeping it, be it in the mid-
or long-term.

This patch removes the `--avoid-exceptions` flag, making it the only option, and
the corresponding `with_exceptions` variant of the dcalc->lcalc translation. It
doesn't do further simplifications.
2024-07-04 15:08:13 +02:00
Louis Gesbert
d073103578 Typecheck operator args bottom-up after monomorphisation
(?)
2024-07-04 15:08:13 +02:00
Louis Gesbert
c0ad0e8820 Closure conversion: recursive hoisting 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
29cb1978e0 Clerk report: add JUnit-compatible XML output 2024-07-04 14:47:50 +02:00
Louis Gesbert
cdb31ffd57
Support for basic clerk.toml configuration files (#639) 2024-07-01 15:40:06 +02:00
Louis Gesbert
c4f6141288 alpine 3.20 broke its latex packages 2024-06-28 11:19:34 +02:00
Louis Gesbert
a6911a4cd5 Cheat-sheet: remove need for exotic latex package
And add required latex fonts
2024-06-27 17:01:55 +02:00
Louis Gesbert
69d8f433e7
Update opam dependencies (#626) 2024-06-27 14:24:21 +02:00
Louis Gesbert
33dbbadca8 Workaround pandoc version changing the result of some tests 2024-06-27 14:00:11 +02:00
Louis Gesbert
81e2d18100 Don't try to read screen columns without a tty 2024-06-27 13:59:25 +02:00
Louis Gesbert
2d756698fb clerk report: allow to choose diff command
Also, detect non-GNU diff or absence of colors, and fallback to a basic view;
this is actually more readable in logs or diffs.
2024-06-27 12:06:24 +02:00
Louis Gesbert
153a029b34 Adjust CI for newer alpine 2024-06-27 10:08:18 +02:00
Louis Gesbert
52f1f14a08 Fix for opam 2.1.6
The fix for the annoying bug with --assume-built has not been backported from
the 2.2 branch.
2024-06-26 17:50:04 +02:00
Louis Gesbert
08dbbcc656
Literate output: adjust catala-metadata margins (#640) 2024-06-26 13:47:48 +02:00
Louis Gesbert
291a8e05e4 Specify latest gmpy2 dependency 2024-06-26 12:40:29 +02:00
Louis Gesbert
446481182f CI: update base build image
We need the new dates_calc and sedlex

Debug notes:
We need the latest ocamlpro/ocaml image (2024-05-26) to get the release of
dates_calc. Unfortunately, it breaks: `pip install gmpy2` could not find
pre-built binaries, so it would "transparently" try to recompile and then
complain about obscure system packages missing (mp libraries). Indeed the newest
image picked up the newer Alpine release (3.20), which is based on a newer musl
release (and apparently that's a problem !?).

Hopefully the proper python dependencies will become available at some point ?
2024-06-26 12:37:57 +02:00
Louis Gesbert
2471c60beb Update some dependencies
- more recent sedlex fixes a bug that needed a workaround in our code
- we need recent dates_calc to avoid extra runtime dependency on `Str` that our
  build system won't handle
2024-06-26 12:37:57 +02:00
Louis Gesbert
647ab22c04 Literate output: adjust catala-metadata margins
to make sure that 80 characters fit in the line
2024-06-26 12:09:15 +02:00
Louis Gesbert
05752988e6 Clerk: add support for basic configuration files
Not much there at the moment, but being able to specify the include directories
is already pretty useful to run clerk directly e.g. on `catala-examples`.

(you had to explicitely specify variable `CATALA_INCLUDE`, the `-I` flags or to
go through `make` without that)
2024-06-26 10:41:12 +02:00
Louis Gesbert
31adaa019f Clerk report: disambiguate empty and missing ref lines 2024-06-24 10:18:19 +02:00
Louis Gesbert
1cb2763587
Clerk reports: postprocess diff output (#638) 2024-06-21 18:20:08 +02:00
Louis Gesbert
38a93424a8 Clerk reports: postprocess diff output
This relies less on specific color flags of GNU diff, and reformats and
colorises the output.
(it may still depend on the specific layout of GNU diff with the `-y` flag
though)
2024-06-21 18:19:09 +02:00
Louis Gesbert
8a6206363e
Testing and debugging closure conversion (#637) 2024-06-21 17:57:02 +02:00
Louis Gesbert
a8a81a199b Makefile: fix annoying leftover .tmp dirs on make alltest 2024-06-21 12:53:53 +02:00
Louis Gesbert
dc1b725e9b Reformat 2024-06-21 12:23:01 +02:00
Louis Gesbert
812aeff736 Update test outputs 2024-06-21 12:23:01 +02:00
Louis Gesbert
7d7dd47216 Closure conversion: add missing Map2 to matched functional operators 2024-06-21 12:23:01 +02:00
Louis Gesbert
0e05c75028 Internal typing: print the faulty program when debug is enabled
Since the typing error happened on generated code, it's hard to debug without
printing it.
2024-06-21 12:23:01 +02:00
Louis Gesbert
70c01749b2 Fix regression on internal typing errors reported as user errors 2024-06-21 12:23:01 +02:00
Louis Gesbert
712fc1e279 Support closure calls across modules
First I was disappointed that we couldn't convert closure environment properly
because of their opaque nature (native/interpreted conversion is based on the
Catala types) ; but after more thought it's actually unnecessary to convert them
at all since we are guaranteed that they can't be consumed outside of their
realm.
2024-06-21 12:23:01 +02:00
Louis Gesbert
d871b95447 Basic support for closure conversion in the OCaml backend 2024-06-21 12:23:01 +02:00
Louis Gesbert
dd3285bb66 Closure conversion: empty tuples are OK
it's much simpler to handle down the line if they have a uniform structure;
empty tuples are easily converted into unit types when translating to OCaml.
2024-06-21 12:23:01 +02:00
Louis Gesbert
676edef101 Closure conversion: handle externals like globals 2024-06-21 12:23:01 +02:00
Louis Gesbert
8881fee37f Allow catala ocaml --closure-conversion
it's probably not useful per se, but will be handy for debugging
2024-06-21 12:23:01 +02:00
Louis Gesbert
09bdc3b4da Printer: print closures as functions
This avoids differences in test results depending on wether closure conversion
is enabled or not: the functional values within structure are a different type
internally but with this patch they are printed the same.
2024-06-21 12:23:01 +02:00
Louis Gesbert
f5b0c7ca7d Closure conversion: quickfix to avoid name clashes
This will need a more serious solution, but this will allow us to continue for now.
2024-06-21 12:23:01 +02:00