catala/compiler
Louis Gesbert 5d432d6bb9 OCaml runtime: register fallback exception printers
This was a pending TODO: now the Catala program compiled into OCaml should
return better messages and a little more information about uncaught exceptions.

Note that this also concerns, at the moment, compiled modules called from the
Catala interpreter: in this case, it's already better than nothing, but what we
need is proper interoperation between the runtime exceptions and the interpreter
handling (`EmptyError` should already be handled properly since it is critical
to the computation flow, but "error" exceptions are left uncaught and will kill
the interpreter).

This may be part of a bigger task on unifying the output of the runtime and
toplevel, which also concerns computation traces.

Note 2: All runtime exceptions don't have a position available, which is quite
unfortunate when your program hits an error. With `OCAMLRUNPARAM=b` and if
compiled with `-g` (which should normally be the case), you can get an OCaml
backtrace but that's not very friendly. Ideas for improvement:
- The runtime could force-enable backtrace recording (`Printexc.record_backtrace
  true`) to supersede the need for `OCAMLRUNPARAM`. We can also record our own
  handler to print the file position and/or backtrace in the way we see fit
- The printer of OCaml code in Catala could insert line directives so that the
  positions in the backtrace actually trace automatically back to the Catala
  code
- If we don't want to leverage any OCaml machinery in this way, the compiler
  should add position information to any operator that might fail (e.g.
  divisions, date comparisons, etc.).
Note that running in trace mode might already help pinpoint the location of the
error ?
2024-04-15 14:13:33 +02:00
..
catala_utils Improve message formatting throughout 2024-04-12 17:07:36 +02:00
dcalc Fix extra_pos/pos 2024-04-12 17:06:44 +02:00
desugared Support for structure updates 2024-04-12 17:17:48 +02:00
lcalc Rewriting message calls to use the new intf 2024-04-10 19:26:23 +02:00
literate Rewriting message calls to use the new intf 2024-04-10 19:26:23 +02:00
plugins Message: further simplification 2024-04-10 19:26:23 +02:00
scalc Rewriting message calls to use the new intf 2024-04-10 19:26:23 +02:00
scopelang Support for structure updates 2024-04-12 17:17:48 +02:00
shared_ast OCaml runtime: register fallback exception printers 2024-04-15 14:13:33 +02:00
surface Support for structure updates 2024-04-12 17:17:48 +02:00
verification Rewriting message calls to use the new intf 2024-04-10 19:26:23 +02:00
catala_web_interpreter.ml Rewriting message calls to use the new intf 2024-04-10 19:26:23 +02:00
catala.ml replace let _ by let () or add type annotation 2023-09-09 22:02:39 +02:00
driver.ml Fix: allow external modules to access the OCaml stdlib 2024-04-13 12:01:47 +02:00
driver.mli Move global options of Cli to their own module 2024-03-19 15:18:35 +01:00
dune CI: cleanup the exposed artifacts 2024-01-22 13:58:32 +01:00
index.mld More doc 2023-06-18 16:08:16 +02:00
plugin.ml Rewriting message calls to use the new intf 2024-04-10 19:26:23 +02:00
plugin.mli Move global options of Cli to their own module 2024-03-19 15:18:35 +01:00
tests.ml Generalise the definition of lists of nested binders 2024-02-09 18:33:41 +01:00