Commit Graph

3580 Commits

Author SHA1 Message Date
Louis Gesbert
b5baa91a2e Add (half-baked) test on module usage
Half-baked because clerk doesn't know to order the tests properly at the moment,
and we spit compiled files into the source test directory.
2023-08-31 18:31:48 +02:00
Louis Gesbert
a71b4e7f73 Some fixes to relative file lookups in modules and tests
This makes sure `catala module` finds the local runtime when run from the catala
source tree; and fixes lookup of the catala exec on custom uses of `clerk runtest`.
2023-08-31 17:55:36 +02:00
Louis Gesbert
17172cf47d Some fixes & cleanup after early review 2023-08-31 17:55:36 +02:00
Louis Gesbert
72882f82df Reformat 2023-08-31 17:55:36 +02:00
Louis Gesbert
c58e76f4e5 Gather the maps for subscope vars to the top level
(they use UIDs so this doesn't jeopardize proper name resolution ; and it allows
resolution of subscope calls without further code modifications)
2023-08-31 17:55:36 +02:00
Louis Gesbert
bcde10242f Specialise the Map.Not_found exception raised by Map.find
... and add a custom printer

Since this is a very common bug, this patch should gain us a lot of time when
debugging uncaught Not_found errors, because the element not found can now be
printed straight away without the need for further debugging.

The small cost is that one should remember to catch the correct specialised
`Foo.Map.Not_found _` exception rather than the standard `Not_found` (which
would type-check but not catch the exception). Using `find_opt` should be
preferred anyway.

Note that the other functions from the module `Map` that raise `Not_found` are
not affected ; these functions are `choose`, `min/max_binding`,
`find_first/last` which either take a predicate or fail on the empty map, so it
wouldn't make sense for them (and we probably don't use them much).
2023-08-31 17:55:36 +02:00
Louis Gesbert
9bac045d03 Implement module lookups for scopes, structs, and enums 2023-08-31 17:54:39 +02:00
Denis Merigoux
7b7a396665
Fix typos for error triggered when no input variables were provided (#498) 2023-08-17 14:00:39 +02:00
Artur Cygan
c33cccd7c1 Improvements to the Polish translation 2023-08-17 12:15:25 +02:00
Adam Olech
8382492816 Fix typos for error triggered when no input variables were provided 2023-08-17 00:47:48 +02:00
Denis Merigoux
13654bde3a
R backend for Catala (#496) 2023-08-07 18:10:44 +02:00
Denis Merigoux
6d7b1f2585
Last fixes 2023-08-07 17:55:04 +02:00
Denis Merigoux
8743b73459
Debugging the R backend 2023-08-07 16:19:13 +02:00
Denis Merigoux
4d419ac167
Switch to S4 classes and package runtime 2023-08-07 15:58:55 +02:00
Denis Merigoux
5adfb0d9ae
Fix annoying highlighting problem
About variables starting with "an" or "ou" in French.
Should be replicated in other languages.
2023-08-07 14:59:52 +02:00
Denis Merigoux
695faebefb Cleaning up 2023-08-05 16:23:29 +02:00
Denis Merigoux
e2f8e56e7d Backend seems to work, needs more debugging 2023-08-05 14:28:18 +02:00
Denis Merigoux
62ea40a40d Fix tryWith compilation 2023-08-05 13:05:31 +02:00
Denis Merigoux
d0483d681a
First test passing 2023-08-04 19:30:43 +02:00
Denis Merigoux
1df2ebda13
Correct compilation of tryCatch 2023-08-04 19:03:10 +02:00
Denis Merigoux
84d37d8720
Print algebraic data types as R classes 2023-08-04 18:07:49 +02:00
Denis Merigoux
fd89562c8b
Starting to implement R backend 2023-08-04 17:25:12 +02:00
Denis Merigoux
fe9143a304
More complete runtime 2023-08-04 16:50:00 +02:00
Louis Gesbert
ac39b6665e Cheat-sheet: fix CI 2023-08-04 16:03:51 +02:00
Louis Gesbert
147ab62fe8 Cheat-sheet: fix compilation
Use xelatex and don't require fonts-extra (which is 1GB) just for two 20-lines
files.
This also syncs the dependencies for the cheat-sheets which those of Catala
literate output, which is good.
2023-08-04 15:36:53 +02:00
Denis Merigoux
f28a1a8a90
Ported Catala runtime to R 2023-08-04 15:21:19 +02:00
Louis Gesbert
4a06faa881 modules plugin: fix target directory of dlls 2023-08-04 12:08:18 +02:00
Louis Gesbert
edd6dce0d8 Disable recursive tests reset for now; remove rel paths in test out 2023-08-04 12:08:18 +02:00
Louis Gesbert
fa33d37d84 Clerk: split code for running tests from the main (Ninja) engine 2023-08-04 12:08:18 +02:00
Louis Gesbert
378669b09e Implement reversing the dependencies for tests
This works for the `--reset` option, but I have some doubts about it.
2023-08-04 12:08:18 +02:00
Louis Gesbert
4cc3bd7e1d
Simplify visitors ppx annotations (#495) 2023-08-04 12:00:09 +02:00
Louis Gesbert
300d993733 Simplify visitors ppx annotations
the small downside is that we lose a little bit of granularity by making
defining all the types at once (with `type ... and`) ; but one well-placed
annotation seems to be enough.

also discarded the `iter` visitor that was unused.
2023-08-04 11:43:16 +02:00
Louis Gesbert
b807c34584
Fix build failure due to breaking change in ppx_yojson_conv (#494) 2023-08-02 19:23:30 +02:00
Louis Gesbert
6af2412930
Update CI build (#493) 2023-08-02 19:22:28 +02:00
Louis Gesbert
ab365b25b3 Clerk: replace colordiff with diff --color
This should be available mostly everywhere now (first appeared in e.g. Ubuntu
18) and avoids the need for an additional run-time dependency.
2023-08-02 15:12:31 +02:00
Louis Gesbert
f35825a9c1 Update CI build 2023-08-02 12:22:24 +02:00
Louis Gesbert
a29abb3e09
Adelaett/nix ocolor (#492) 2023-08-02 12:22:12 +02:00
Micah Cantor
3b1c23c054 add explicit yojson open 2023-08-02 12:17:28 +02:00
adelaett
c33b27b878
update flakes file 2023-07-31 16:24:41 +02:00
adelaett
2911003088
add ocolor as a dependency 2023-07-31 16:19:06 +02:00
Louis Gesbert
f0f8c088ce
Clearer errors (#481) 2023-07-13 10:24:35 +02:00
Aminata-Dev
94f8eac858 Better indications for the user :
- We're able to say from the parser what the user could have written. It may not be complete due to the acceptable function of Menhir : it is only an indication given to the user (and not intended to be an adaptive documentation)
- .mli file added : module interface for suggestions
- Add a test that provides a typographical or a logical error.
- Documentation and type / name changes for suggestions
2023-07-12 16:32:55 +02:00
Louis Gesbert
d0fae323d0
Add some helper functions in a wrapper Map module (#490) 2023-07-12 14:35:40 +02:00
Louis Gesbert
c96c6e187f Re-implement the GNU message output format 2023-07-12 13:57:58 +02:00
Aminata-Dev
af9c708960 Better help for the user
- Clearer (more detailed) error messages (see parser.messages, parser_driver.ml ->)
	--> Parser_driver.ml : we're more precise and show all possible instructions to the user.
- Suggestions.ml : unimportant display changes + renaming
2023-07-12 11:55:11 +02:00
Aminata-Dev
6123ebd004 get re(c)t 2023-07-12 11:55:11 +02:00
Aminata-Dev
f8755f0202 Update of autogenerated files 2023-07-12 11:55:11 +02:00
Aminata-Dev
b0d16c1a58 Tests updated 2023-07-12 11:55:11 +02:00
Aminata-Dev
17469565ec Improve the implementation of suggestions
- suggestions.ml : improve details + algorithm implementation (see @Altgr reviews) + comments
- suggestions implementation : since we want to keep the same structure to display suggestion messages, Suggestion is no longer a formatted string but a string list. The goal is to have a similar formatted string for each suggestion, no matter what the error message is.
--> This involves changes to suggestions.mli, compiler/desugared/from_surface.ml (most important one) and compiler/surface/parser_driver.ml
2023-07-12 11:55:11 +02:00
Aminata-Dev
b087ca4f47 Improve suggestions
- Improved implementation of suggestions (suggestion_minimum_levenshtein_distance_association > suggestions.ml)
- Magnifying glass emoji added for suggestions
- Improve display by...
	- Fixing "Pos.ml" (pretty-printing box not closed)
	- Remove unnecessary spaces
- compiler/surface/parserdriver.ml
	- Optionnal suggestions added when raising a parser error
	- Function "levenshtein_distance" removed and replaced by "Suggestions.levenshtein_distance"
- Tests updated (mostly line breaks and spacing changes)
- Variable names renamed for greater clarity
- (Based on commit 0813f5c36e)
2023-07-12 11:55:11 +02:00