Commit Graph

4103 Commits

Author SHA1 Message Date
Louis Gesbert
33ce233a29 Fix lexing of verbatim blocks
Catala doesn't interpret them at all, but it needs to refrain from interpreting
its contents as markdown (titles, etc.)
2024-05-16 15:46:39 +02:00
Louis Gesbert
caf9135b4e Fix CI script (3)
The `-C` option in Alpine's `tar` doesn't work.
The `--strip-components` only affects extraction and it isn't specified.
2024-05-15 16:20:27 +02:00
Louis Gesbert
ac37d50d8c Fix CI script (2) 2024-05-15 14:52:02 +02:00
Louis Gesbert
88d7013253 Fix CI script 2024-05-15 13:41:59 +02:00
Louis Gesbert
fcb6829227
Fix building and publishing of the website assets (#620) 2024-05-15 13:05:31 +02:00
Louis Gesbert
56328fec16 CI: publish packed website artifacts alongside the rest 2024-05-15 11:52:23 +02:00
Louis Gesbert
62414562eb Makefile: fix target website-assets.tar 2024-05-15 11:32:01 +02:00
Louis Gesbert
bd30fe8d50
Unify traces between interpreter and runtime (#615) 2024-05-15 10:59:15 +02:00
Louis Gesbert
5f289307a0 Runtime value printer: use <object> on non-printable entitites 2024-05-15 10:24:18 +02:00
Raphaël Monat
e78c225437 Another fix to Python runtime 2024-05-15 09:08:53 +02:00
Raphaël Monat
3426ca3617 Python backend: fix money multiplication, round 2024-05-10 15:36:40 +02:00
Raphaël Monat
a076dc70b6 Python runtime: remove quoted type annotations 2024-05-10 12:19:53 +02:00
Raphaël Monat
43218e31ce Python runtime: fix rounding 2024-05-10 12:19:53 +02:00
Louis Gesbert
1cf34d9123 Fix formatting of syntax error messages 2024-05-08 12:36:56 +02:00
Louis Gesbert
1efdf4262d Clerk: fix finalisation on exit
We have temporary files to remove upon `ninja` completion so it's not a good
idea to `exec` without fork. This patch ensures `/tmp/clerk_*.ninja` files
aren't left in `/tmp`.
2024-05-08 12:27:10 +02:00
Louis Gesbert
affa45c115 Unify traces between interpreter and runtime
This is a first step into unifying trace handling. This patch only affects the
interpreter, by delegating trace recording to the already existing runtime
functions.

At end of interpretation, it recovers the registered trace from the runtime, and
prints it.

NOTE: there are some limitations due to this approach, as runtime values going
through this interface have to be converted to the "runtime embedded" type. In
particular, functions can no longer be printed (which makes full sense if we
want it to happen in the same way in compiled code) ; some information, like
types, is lost, but it didn't appear to be used.

Also, a specific printer had to be added for runtime values (but it's very
simple so that shouldn't be a problem).

@denismerigoux I'd like your input on how well this goes for your use-cases.

Further work should probably be cleanup and unification of the runtime logging
interfaces ; there is already code for re-structuring the traces, printing to
JSON, etc. which could be common to runtime and interpreter.
2024-05-06 22:16:54 +02:00
Louis Gesbert
59b0f21ff8
Fixes for 0.10.0 (#617) 2024-05-06 22:15:57 +02:00
Louis Gesbert
51ba370f06 Update opam file according to opam-repository reviews 2024-05-06 21:39:58 +02:00
Louis Gesbert
8ad3b68d5f Fix 'make testsuite' return value 2024-05-06 21:39:58 +02:00
Louis Gesbert
3d1e9a56bf Fix adjustment of format width to terminal 2024-05-06 21:39:58 +02:00
Louis Gesbert
0ee512b832 Bump version in package descriptions to 0.10.0 2024-05-06 13:51:05 +02:00
Louis Gesbert
8d659d0557
Cleaner message printing (#614) 2024-05-03 15:57:57 +02:00
Louis Gesbert
19672d2305 Messages: ensure disabled messages aren't computed 2024-05-03 15:27:06 +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
Denis Merigoux
da89411189
Restore formatting 2024-05-03 13:55:19 +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
Denis Merigoux
0f425dc408
Unify runtime error handling (#611) 2024-05-03 10:11:36 +02:00
Denis Merigoux
8288754de2
JSOO runtime fix 2024-05-03 09:35:20 +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
4d412027d0 Remove direct dependency towards dates_calc from the compiler
The dependency should only go through the `Runtime` module
2024-05-02 16:30:46 +02:00
Louis Gesbert
a8635f0e61 Simplify unthunking function ; cleanup warnings in 'make testuite' 2024-04-30 17:56:06 +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
59740bd560 QoL: guess the scope and make suggestions on 'interpret' command
when no scope was specified
2024-04-30 17:55:55 +02:00
Louis Gesbert
cee8e57d02 More precise positions for operators throughout 2024-04-30 16:35:08 +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
959bcb9ccd Remove obsolete "except" type from the interpreter 2024-04-29 13:42:40 +02:00
Louis Gesbert
4f6769c7f2 Adjust exception handling in the Python backend
in order to match the exceptions in OCaml
2024-04-29 11:47:41 +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
791ae3229b Messages: adjust to terminal width 2024-04-26 15:40:55 +02:00
Louis Gesbert
97d007f1e7 Rename EmptyError to Empty
It's not an error! It happens in the normal control flow :)

This is to distinguish from the other runtime exceptions which are actually
fatal errors.
2024-04-25 14:39:15 +02:00
Louis Gesbert
fe2a562730 Cheat-sheets fixes and improvements 2024-04-25 14:20:22 +02:00
Louis Gesbert
3e2aa54b81
Fix some statement orderings in scalc (#608) 2024-04-23 16:40:31 +02:00
Louis Gesbert
1412e76938 Clerk: fix OCaml linking options to allow inlining
Fixes occurences of `Warning 58 [no-cmx-file]: no cmx file was found in path for
module` during builds.
2024-04-23 16:01:23 +02:00
Louis Gesbert
090faf8c9f Fix statement ordering in scalc 2024-04-23 16:01:23 +02:00
Louis Gesbert
d72141653a Allow trace w/ avoid-exceptions, fix options in api_web
--trace and --avoid-exceptions is a warning, but we want to be able to test with
the combination (in particular, api_web as forcing --trace, so we couldn't
detect its issues with exceptions).
2024-04-23 16:01:23 +02:00
Louis Gesbert
36ca23eb89 Cheat-sheet: minor adjustments 2024-04-23 16:01:23 +02:00
Louis Gesbert
62c9500b63
Add env variables to set flags -O, --avoid-exceptions, --trace (#607) 2024-04-23 16:00:00 +02:00
Louis Gesbert
96ea034839 Clerk: clean up CATALA_* variables on tests 2024-04-19 16:50:36 +02:00
Louis Gesbert
623d2ef03d Add env variables to set flags -O, --avoid-exceptions, --trace
It makes it easier to batch-set them when testing a given repo with different
sets of options. Direct flags should still be preferred in general, of course.
2024-04-19 15:30:51 +02:00