Commit Graph

4020 Commits

Author SHA1 Message Date
Louis Gesbert
081605d04d tests: check the generated C code
(and update for new errors)
2024-05-30 16:19:55 +02:00
Louis Gesbert
9af7548bf0
Implement module hashes and checks (#625) 2024-05-28 12:36:40 +02:00
Louis Gesbert
db87409125 Replace module hashes for external modules
NOTE: This is a temporary solution

A future approach could be to have Catala generate a module loader (with the
proper hash), relieving the user implementation from having to do the
registration.
2024-05-28 11:43:50 +02:00
Louis Gesbert
f04e889173 Pass the "external module" info along passes 2024-05-28 11:43:50 +02:00
Louis Gesbert
709b51beb6 Fix hashing of submodule references 2024-05-28 11:43:50 +02:00
Louis Gesbert
072d428fc3 Ensure each module interface is computed only once
(they can appear multiple times in the tree of dependencies)
2024-05-28 11:43:50 +02:00
Louis Gesbert
c9be9bc3ad Update test ouputs 2024-05-28 11:43:50 +02:00
Louis Gesbert
d0998312eb Inline tests: add lightweight sanitisation of the command outputs 2024-05-28 11:43:50 +02:00
Louis Gesbert
a94c5fe644 Clerk runtest: bufferise command output
instead of directing the output directly to the file.
2024-05-28 11:43:50 +02:00
Louis Gesbert
403156b36e Computation and checking of module hashes
This includes a few separate changes:

- pass visibility information of declarations (depending on wether the
  declaration was in a ```catala-metadata block or not)

- add reasonable hash computation functions to discriminate the interfaces. In
  particular:
  * Uids have a `hash` function that depends on their string, but not on their
    actual uid (which is not stable between runs of the compiler) ; the existing
    `hash` function and its uses have been renamed to `id`.
  * The `Hash` module provides the tools to properly combine hashes, etc. While
    we rely on `Hashtbl.hash` for the atoms, we take care not to use it on any
    recursive structure (it relies on a bounded traversal).

- insert the hashes in the artefacts, and properly check and report those (for
  OCaml)

**Remains to do**:

- Record and check the hashes in the other backends

- Provide a way to get stable inline-test outputs in the presence of module
  hashes

- Provide a way to write external modules that don't break at every Catala
  update.
2024-05-28 11:43:50 +02:00
Louis Gesbert
372058bc42
Combine English and French VS Code extensions (#622) 2024-05-22 16:12:38 +02:00
Denis Merigoux
e7853d69cf
Fixes in Python runtime (#618) 2024-05-21 12:05:17 +02:00
Louis Gesbert
6322e5c001 VScode: add LICENSE.txt before publication 2024-05-21 11:43:00 +02:00
Louis Gesbert
830f9fc84a vscode extension: add registered publisher name 2024-05-21 11:23:25 +02:00
Louis Gesbert
bca0fb84a8 Update the Catala vscode extension README 2024-05-21 11:20:24 +02:00
Sam Estep
5749eb6db8 Combine English and French VS Code extensions 2024-05-17 15:54:38 -04:00
Louis Gesbert
831b630f55
Fix lexing of verbatim blocks (#621) 2024-05-16 15:47:54 +02:00
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