Commit Graph

537 Commits

Author SHA1 Message Date
Denis Merigoux
58cb48fb28
Merge remote-tracking branch 'origin/master' into aides_logement 2022-07-20 11:20:00 +02:00
Denis Merigoux
6d224e1a41
Merge pull request #272 from AltGr/types-everywhere
Annotate the ASTs with type information everywhere
2022-07-20 11:07:17 +02:00
Louis Gesbert
e2e90cd080
Remove stale comment in dune file 2022-07-20 10:57:56 +02:00
Louis Gesbert
d9fbaa704b Restore some commented out code, add some comments 2022-07-19 21:41:55 +02:00
Louis Gesbert
b9099ac7a4 Use resolved types in type annotations
Adding an 'inferring' annotation type only used during typing
2022-07-19 18:47:00 +02:00
Denis Merigoux
793efb4682
In the process of switching some money types to decimal [skip ci] 2022-07-19 13:53:12 +02:00
Denis Merigoux
be373f0ff5
Added primitives money_to_decimal and decimal_to_money [skip ci] 2022-07-19 11:53:09 +02:00
Denis Merigoux
05115c7541
Help OCaml's type inference
Needed because of constructor name confusion
2022-07-14 15:29:50 +02:00
Denis Merigoux
fffa318144
Don't print functions on CLI tracing mode; they're too big 2022-07-13 17:27:08 +02:00
Louis Gesbert
61063b5234 Small cleanup and clarifying a dark spot of the Ast interface 2022-07-13 12:28:08 +02:00
Louis Gesbert
83de1a229b Mark the optimization passes as untyped
It's not expected to stay that way forever, but some additional effort will be required for them to preserve (or restore) types; until then, be safe and don't forward possibly incorrect information.
2022-07-13 12:17:43 +02:00
Emile Rolley
4991350b58 feat(backend/ocaml): disambiguate OCaml record names derived from Catala struct 2022-07-12 16:12:18 +02:00
Louis Gesbert
97120c4dc2 compiler/verification: force a typed AST as input 2022-07-12 15:57:50 +02:00
Louis Gesbert
7485c7f2ce Reformat 2022-07-11 17:42:34 +02:00
Louis Gesbert
985ecdac6d Bump required OCaml version to 4.13
This version of OCaml introduces [let-punning](https://v2.ocaml.org/manual/bindingops.html#ss:letops-punning)

It is just syntactic sugar, but OCamlformat makes use of it, without a configuration option, when the OCaml version permits.
This means that the same version of OCamlformat gives different results depending on the underlying OCaml version. Our options, if we want to keep the forced-format policy on the repository, are therefore:
- to disable it whenever binding operators are used (with this PR that's a lot of places, and this becomes too cumbersome, besides defeating the purpose)
- to force devs to use an earlier version of OCaml so that reformatting outputs something compatible
- to bump the minimum OCaml requirement

The latter is the simplest, but it can be reviewed if compatibility is required. Last option would be to report the issue to OCamlformat and hope that they provide a workaround...
2022-07-11 17:42:34 +02:00
Louis Gesbert
504f54c31e Rework type error reporting 2022-07-11 17:42:34 +02:00
Louis Gesbert
02fc255177 Typing scopes: bottom-up rather than top-down
it's better for error messages (and similar to how it was done before)
2022-07-11 17:42:34 +02:00
Louis Gesbert
18e86621d5 Port verification code to the AST changes 2022-07-11 17:42:34 +02:00
Louis Gesbert
5f882e35a2 dcalc ast: make the map function more polymorphic 2022-07-11 17:42:34 +02:00
Louis Gesbert
49efb5ddd7 Improve debugging, add backtraces (when recording is enabled) 2022-07-11 17:42:34 +02:00
Louis Gesbert
296a1de7dd Typing: add functions to type scopes without conversion to expr 2022-07-11 17:42:34 +02:00
Louis Gesbert
4eb5933ad0 Porting the interpreter to the marked AST 2022-07-11 17:42:30 +02:00
Louis Gesbert
6cc2e9a07b typing.ml: fix use of bindlib 2022-07-11 16:51:54 +02:00
Louis Gesbert
67179a793c Add type annotations on all AST nodes (first pass) 2022-07-11 16:51:54 +02:00
Louis Gesbert
513647cd32 AST simplification: remove redundant annotations
The AST structures track annotations (e.g., at the moment, source code
position information) in a lot of places. This patch tidies up a bit and
removes some duplication, ensuring a single level of annotation wrapping
at each AST recursion level.

This will be important when adding type information in these
annotations, because there will be consitency constraints to be ensured
and duplication is a likely source of mistakes.
2022-07-11 16:51:54 +02:00
Louis Gesbert
af0ac95682 Propagate renaming of Pos.mark* into module Marked
this patch is just a bunch of `sed` commands

```shell
cd compiler
sed -i 's/Pos.marked/Marked.pos/g' *.ml* **/*.ml*
sed -i 's/Pos.unmark/Marked.unmark/g' *.ml* **/*.ml*
sed -i 's/Pos\.get_position/Marked.get_mark/g' *.ml* **/*.ml*
sed -i 's/Pos\.same_pos_as/Marked.same_mark_as/g' *.ml* **/*.ml*
sed -i 's/Pos\.map_under_mark/Marked.map_under_mark/g' *.ml* **/*.ml*
sed -i 's/Pos\.mark/Marked.mark/g' *.ml* **/*.ml*
sed -i 's/Pos\.compare_marked/Marked.compare/g' *.ml* **/*.ml*
```
2022-07-11 16:51:54 +02:00
Louis Gesbert
481aea83e0 Generalise the type for AST node markings 2022-07-11 16:51:54 +02:00
Louis Gesbert
d7dbbde26f
Merge pull request #285 from CatalaLang/fix_192
Partially fix #192
2022-07-11 16:43:48 +02:00
Denis Merigoux
66a7d2f7a3 Fix test encoding 2022-07-08 15:37:01 +02:00
Denis Merigoux
fa0d94a2b6
Remove authors feature whose behavior is not satisfactory 2022-07-08 14:41:19 +02:00
Denis Merigoux
bdbf202a8d
Minimal implementation of https://github.com/CatalaLang/catala/issues/192#issuecomment-1178750411 2022-07-08 14:10:25 +02:00
Denis Merigoux
a34a330dc4
Fix breaklines in LaTeX 2022-07-06 17:37:42 +02:00
Denis Merigoux
5e45940e1b
Merge branch 'master' into allocations_logement 2022-07-06 16:43:14 +02:00
Emile Rolley
97cf14b3f5 refactor(runtime): ignore function definition while parsing raw events 2022-06-23 17:35:11 +02:00
Emile Rolley
22100d5b62 feat(runtime/api_web): add serialization for event + retrieveEvents in the API 2022-06-16 17:24:35 +02:00
Emile Rolley
e35e4a7cb4 feat(runtime): clean parse_raw_events + add documentation 2022-06-16 11:39:37 +02:00
Emile Rolley
9b5779ed62 feat(runtime): format_events -> pp_events (Done). 2022-06-15 19:32:45 +02:00
Emile Rolley
d82ecb5f12 fix(compiler/log): retrieve types of input and output function calls 2022-06-15 14:34:15 +02:00
Emile Rolley
d1a7be688c feat(runtime): start to implement format_events 2022-06-14 17:42:13 +02:00
Emile Rolley
092b57c898 feat(runtime): implement the raw_event parser 2022-06-13 17:59:00 +02:00
Emile Rolley
84f79be7b7 feat(runtime): define the event type 2022-06-09 17:17:12 +02:00
Emile Rolley
f7787ff80d fix(compiler): fix line num for HTML generation 2022-06-08 17:21:15 +02:00
Denis Merigoux
34fd8a0bb2
Print a position when logging assignment of a default false for a condition 2022-06-03 17:50:03 +02:00
Denis Merigoux
ab0f4eb28c
Merge branch 'master' into allocations_logement 2022-06-01 17:28:54 +02:00
Denis Merigoux
6e4e646dd8
More robust implementation of duration multiplication 2022-06-01 15:15:22 +02:00
Denis Merigoux
878de024b7
Better error message 2022-06-01 11:13:14 +02:00
Jonathan Protzenko
0e68c07567 Reset parser messages 2022-06-01 10:26:14 +02:00
kescher
db9eec3b9f add support for duration multiplication
Signed-off-by: Jonathan Protzenko <protz@microsoft.com>
2022-05-31 11:17:38 -07:00
Denis Merigoux
89db6d9b69
Fix logging regression involuntarily introduced by #268 2022-05-31 16:09:32 +02:00
Louis Gesbert
9ef8625df7 Compiler: support cumulative exceptions
Closes #208 (implementing Solution 1, without adding an explicit syntax)

Two exceptions or more, e.g. `(j1 |- c1)` and `(j2 |- c2)` such that `c1
= c2`, are collapsed by this transformation into `((j1 |- c1) | j2 |-
c2)`, introducing an arbitrary precedence that avoids the conflict.

The transormation is not applied if any exceptions apply to the subterms
themselves: while these exceptions could be merged, that would turn more
conflicts into arbitrary outcomes than wanted.
2022-05-30 14:22:34 +02:00