Commit Graph

20 Commits

Author SHA1 Message Date
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
6cb19b4f0b Update relevant test results 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
812aeff736 Update test outputs 2024-06-21 12:23:01 +02:00
Louis Gesbert
21cea5c968 Closure conversion fix
Support for manipulating toplevel functions as values was buggy, because the
recursion after eta-expansion would fall into the pattern for a `let..in` and
not do the expected transformation.

The patch explicitely builds the closure in that case, avoiding such issues with
recursion.
2024-06-21 12:23:01 +02:00
Louis Gesbert
23b196aace Types printer: use commas rather than * for tuples 2024-06-21 12:16:49 +02:00
vbot
8c95971f1e
Fix error message typo 2024-06-05 15:19:12 +02:00
Louis Gesbert
396ea03ff9 Message formatting: some more space for results 2024-05-03 15:27:06 +02:00
Louis Gesbert
56b456d137 Message formatting: final touches 2024-05-03 15:14:51 +02:00
Louis Gesbert
c864f658c8 Cleaner message printing
Aerates the printing of messages, removes extraneous noise, and more clearly
attaches the various information tied to a given message.
2024-05-03 12:21:34 +02:00
Louis Gesbert
facce68b25 Make refactored runtime error messages clearer
mostly reverting to the ones the interpreter was printing ; for the case of
divisions, we choose to point to the denominator instead of the operator as it's
where the only possible error (division by zero) comes from.
2024-05-02 16:30:47 +02:00
Louis Gesbert
c01d4ac512 Fix exception positions being lost during translation/optimisations
Positions within the Default terms are specially important since they can come
from separate definitions in the source (before this, we would be falling back
to the single declaration).
2024-04-30 17:56:06 +02:00
Louis Gesbert
50d686f089 Pass exception positions to the HandleDefault operators
This puts runtime exception info on par with what we had in the interpreter, and
repairs the regression on the interpreter which no longer had them.
2024-04-29 16:09:38 +02:00
Louis Gesbert
9d07015864 Unify runtime error handling
- Clearly distinguish Exceptions from Errors. The only catchable exception
  available in our AST is `EmptyError`, so the corresponding nodes are made less
  generic, and a node `FatalError` is added

- Runtime errors are defined as a specific type in the OCaml runtime, with a
  carrier exception and printing functions. These are used throughout, and
  consistently by the interpreter. They always carry a position, that can be
  converted to be printed with the fancy compiler location printer, or in a
  simpler way from the backends.

- All operators that might be subject to an error take a position as argument,
  in order to print an informative message without relying on backtraces from
  the backend
2024-04-26 18:31:26 +02:00
Louis Gesbert
b78cd9c29a
Improve message formatting throughout
Ensuring messages don't print overlong lines still requires some manual work:
- if they don't contain any `Format` directives (`%` or `@`), use `"%a"
  Format.pp_print_text` to turn word-wrapping on.
- otherwise replace spaces with `@ ` to mark possible cutting points, as soon
  that it's possible the line will get over 80 chars (most often, this means
  starting before the first `%a`)
2024-04-12 17:07:36 +02:00
Louis Gesbert
0ec04c4925 Branch cleanup and test outputs update
Lots of tests have a new warning because they were calling subscopes without
using their outputs. A better solution could be to mark these subscopes as
`output`, now that it's possible !
2024-04-04 10:55:21 +02:00
Louis Gesbert
20c1dee5cb Tests: add catala test-scope pseudo-command for inline tests 2024-02-26 14:56:43 +01:00
Louis Gesbert
2f2924944a Syntax: add keywords in front of list filtering / arg-extremum
Closes #574
2024-02-14 13:55:03 +01:00
Louis Gesbert
36866a919b Tests: remove redundant part in filenames 2024-02-12 18:03:16 +01:00