Commit Graph

1223 Commits

Author SHA1 Message Date
Louis Gesbert
9aed2c7479 support for parsing Module directives 2023-09-27 13:08:11 +02:00
Denis Merigoux
ec18ac10bb
Fix missing implem 2023-09-22 18:06:44 +02:00
Denis Merigoux
1f4805caad
Print interpreter error messages with localized expression printer 2023-09-22 18:06:43 +02:00
Denis Merigoux
9cecf5587a
Register surface syntax languge in program troughout the compilation chain 2023-09-22 18:05:26 +02:00
Denis Merigoux
ea838ed6af
Comment 2023-09-22 18:05:26 +02:00
Denis Merigoux
7bad9aa20e
Improve assertion failure message 2023-09-22 18:05:26 +02:00
Denis Merigoux
38782fa546
Correct fix 2023-09-22 18:02:44 +02:00
Denis Merigoux
5eba0b6562
Trying 2023-09-21 13:57:54 +02:00
Denis Merigoux
7971cb7651
Break lines in code Latex output 2023-09-21 13:30:30 +02:00
Louis Gesbert
c63d74647d Optim: avoid extra translations in the interpreter
A recent patch introduced custom terms in expressions manipulated by the
interpreter. For typing reasons, a traversal is done to extend the supplied
expression with these custom terms — it's functionally the identity, but, due to
the fact that the type-checker can't infer covariance of our AST terms on their
phantom parameter, playing by the rules imposes a full traversal + rebuild.

Without resorting to a (constrained) `Obj.magic`, this patch avoids extra
intermediate conversions, which is enough to cut out the huge extra cost we were
incurring.

Closes #516
2023-09-19 18:22:43 +02:00
Denis Merigoux
af1fbe884c
Encapsulate by default all Web API calls with execute_or_throw_error 2023-09-15 10:29:31 +02:00
Louis Gesbert
3cc77f4601
Improvements to the Polish translation (#499) 2023-09-13 16:19:06 +02:00
Denis Merigoux
c1d4592998 Correct MR_* fields for characters with accents 2023-09-13 14:14:47 +02:00
zapashcanon
97e5b15531
replace let _ by let () or add type annotation 2023-09-09 22:02:39 +02:00
Louis Gesbert
9a596a48f7 Improvements to searching for libs at runtime (plugins, runtime, etc.) 2023-09-04 09:57:49 +02:00
Louis Gesbert
4910158aea Reformat 2023-09-01 16:24:27 +02:00
Louis Gesbert
fe2c66af12 Select colors for Uids upon instanciation
This way different Uid kinds will have a consistent color across error messages,
AST dumps, etc.
2023-09-01 14:41:56 +02:00
Louis Gesbert
dcb057bc6f
Module support: handle structs, enums and scope calls across modules (#497) 2023-09-01 14:35:58 +02:00
Louis Gesbert
544e18e110 Fixes related to environments and lookups 2023-08-31 18:31:48 +02:00
Louis Gesbert
8278bb8c5d Make the passes appear more clearly in the driver debug 2023-08-31 18:31:48 +02:00
Louis Gesbert
ff60aee5ef Improve module error messages 2023-08-31 18:31:48 +02:00
Louis Gesbert
e75ea3da07 Cleanup tmp debug code 2023-08-31 18:31:48 +02:00
Louis Gesbert
8e33355ead Reformat 2023-08-31 18:31:48 +02:00
Louis Gesbert
6bccd89482 Fix OCaml backend for cross-module refs 2023-08-31 18:31:48 +02:00
Louis Gesbert
7db63e5f78 Simplification: store paths in Uids
rather than scattered in structures

The context is still hierarchical for defs though, so one needs to retrieve the
path to lookup in the correct context for info. Exceptions are enums and struct
defs, which are re-exposed at toplevel.
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
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
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
Louis Gesbert
4a06faa881 modules plugin: fix target directory of dlls 2023-08-04 12:08:18 +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
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
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