Commit Graph

838 Commits

Author SHA1 Message Date
Denis Merigoux
e41e0f9dcc
Fix line length and display lines of code 2022-08-26 12:05:22 +02:00
Louis Gesbert
ef36b18dfe And finally the desugared AST as well 2022-08-26 11:31:14 +02:00
Louis Gesbert
01cc957b3b Used shared_ast for scopelang expressions 2022-08-26 11:31:14 +02:00
Louis Gesbert
a6702808ef Handle additional scopelang cases in helper functions 2022-08-26 11:31:14 +02:00
Louis Gesbert
49e37c71b4 Add scopelang / desugared cases to the shared AST expressions 2022-08-26 11:31:14 +02:00
Louis Gesbert
54eee2edea Rationalise the tuple / enum types
This will allow to unify with types used earlier in the
pipeline (`Scopelang.Ast.typ`).

It seems cleaner! But some areas may warrant a later clean-up, in particular
handling of options and their types in the backends, or possible name conflicts
of structs/enums with built-in types when printing.
2022-08-23 15:48:06 +02:00
Louis Gesbert
4caf828e48 Additional cleanup/fixes on the compiler refactoring
following review ^^
2022-08-23 00:13:02 +02:00
Louis Gesbert
576e0fb3ff Factorise AST printers
Note that there were significant differences between the two printers (see the test diff!). Overall the `dcalc` one seemed newer so that's what I took, with only the required additions from `lcalc` (exceptions, raise and catch)
2022-08-22 19:28:27 +02:00
Louis Gesbert
ae2801be6d Move mode handling code from dcalc to shared_ast
Handling code should now be reasonably well sorted between `Shared_ast.{Var,Expr,Scope,Program}`

The function parameters (e.g. `make_let_in`) could be removed from the
scope handling functions since now the types are compatible, which
makes them much easier to read.
2022-08-22 19:28:27 +02:00
Louis Gesbert
d02c02e352 Fix some warnings 2022-08-22 19:28:27 +02:00
Louis Gesbert
8e7f65d204 Split Shared_ast.Expr of scope and program functions 2022-08-22 19:28:27 +02:00
Louis Gesbert
4bb49c14f1 Simplify some type aliases 2022-08-22 19:28:27 +02:00
Louis Gesbert
a74ccd30eb Add some documentation on the new lib 2022-08-22 19:28:27 +02:00
Louis Gesbert
06dbab74d2 reformat 2022-08-22 19:28:27 +02:00
Louis Gesbert
2b6ee8dd4b Leverage the shared AST: big cleanup (part I) 2022-08-22 19:28:21 +02:00
Louis Gesbert
988e5eff1c Split the shared AST into a separate lib 2022-08-22 19:16:28 +02:00
Denis Merigoux
4455b8fb0c
Stub before correct replacement 2022-08-19 15:21:38 +02:00
Denis Merigoux
755b1212a2
Remove division durations 2022-08-19 15:21:29 +02:00
Denis Merigoux
e5aed3efcb
Merge branch 'master' into rmonat_dates_calc_lib 2022-08-19 14:59:46 +02:00
Denis Merigoux
b5c4608ce1
Message 2022-08-19 14:43:56 +02:00
Raphaël Monat
0b73fbbac4 Add support for first and last day of month operators 2022-08-18 21:22:50 +02:00
Denis Merigoux
7ee971c4e1
Remove unused type definitions 2022-08-16 14:33:37 +02:00
Denis Merigoux
437be673ce
Merge branch 'master' into aides_logement 2022-08-16 14:25:06 +02:00
Denis Merigoux
2c40802c57
Fix again line numbers in HTML 2022-08-16 11:46:20 +02:00
Denis Merigoux
efa7cec4c1
Merge pull request #315 from AltGr/ast-factorisation
Factorise ASTs (between dcalc and lcalc)
2022-08-16 11:42:51 +02:00
Denis Merigoux
2ae0efa5dd
Fix subtle bug with the default false value for conditions 2022-08-15 16:47:36 +02:00
Denis Merigoux
1aeb47effd
Fix uncaught type error 2022-08-15 16:20:31 +02:00
Louis Gesbert
0b0e774d1c More factorisation, in particular for variables 2022-08-12 17:18:06 +02:00
Louis Gesbert
ebf97a0995 Pass-specific literals 2022-08-12 16:55:32 +02:00
Louis Gesbert
b5579cde3d Generalise the expressions between dcalc and lcalc
The huge benefit of this approach is that almost no changes are needed and we get compatible types between dcalc and lcalc, allowing to deduplicate a few functions.

It might not be the best in the long run: there are still benefits in factorising small parts of the AST as suggested in #157, and this forces a central AST definition that makes the nanopass-like approach a bit less legible.

Still, I think it's a step in the right direction and it doesn't really lock us in keeping to use the big GADT (as the minimal cascade of changes show).
2022-08-12 16:55:30 +02:00
Denis Merigoux
c6e448a9b7
Correctly escape character in HTML weaving 2022-08-12 09:51:43 +02:00
Denis Merigoux
62b984c83c
Don't print functions in interpreter 2022-08-11 18:13:25 +02:00
Denis Merigoux
da06bedaca
Fix HTML line numbers 2022-08-11 16:15:52 +02:00
Denis Merigoux
038e6068e6
Small improvements to housing benefits 2022-08-10 18:13:07 +02:00
Denis Merigoux
3a3c08ba7c
Fix LegiFrance link generation 2022-08-10 10:52:46 +02:00
Denis Merigoux
228b6c830a
Fix line numbers in LaTeX and HTML with leading comments in code 2022-08-10 10:45:49 +02:00
Denis Merigoux
a77fa65f9c
Documentation about plugins 2022-08-09 15:00:13 +02:00
Louis Gesbert
f35f18b295 Add local 'let in' bindings 2022-08-09 12:17:31 +02:00
Denis Merigoux
03e598128a
Bumping version number 2022-08-08 17:26:07 +02:00
Denis Merigoux
d03d82a0e7
Correctly count columns 2022-08-08 17:25:08 +02:00
Raphaël Monat
3e71f25bfe Post merge fixes on using dates_calc 2022-08-06 17:49:06 +02:00
Raphaël Monat
ffd2e1dec3 Merge branch 'master' into dates_calc_lib 2022-08-06 17:26:55 +02:00
Raphaël Monat
4f12338d49 Switch from calendarlib to in-house dates_calc 2022-08-06 17:07:01 +02:00
Denis Merigoux
4d465b33b4
Helpful error message when trying to interpret a scope with arguments 2022-08-06 13:35:17 +02:00
Emile Rolley
f30dc376fd doc(compiler): add information about the html generation logic + complete the doc of the Utils module 2022-08-05 19:03:59 +02:00
Emile Rolley
70672088fa nitpick: String_common.is_uppercase renamed in String_common.is_uppercase_ascii 2022-08-05 18:18:06 +02:00
Emile Rolley
eacc4dcc90 fix(html): sanitize href of line links in code blocks 2022-08-05 10:55:48 +02:00
Emile Rolley
ba620fca28 ocamlformat: new break-infix rule 2022-08-05 10:55:48 +02:00
Emile Rolley
d85812109c refactor(compiler): remove the camomile dependency due to the new Utils.String_common module based on Ubase 2022-08-05 10:55:45 +02:00
Emile Rolley
03aebf7f1c feat(backends/html): improve the code generation with ToC and details tags 2022-08-05 10:55:45 +02:00
Louis Gesbert
a569589193 Small improvements to the Python and OCaml pretty-printers 2022-08-04 20:43:39 +02:00
Louis Gesbert
922126b5cd Improve api_web pretty-printer 2022-08-04 17:36:50 +02:00
Louis Gesbert
e63860de4b Disable ocamlformat on api_web 2022-08-04 17:36:50 +02:00
Louis Gesbert
bc8eda581c Add a script generating static builds
We have an obvious limitation: static builds won't support plugins. We
could resort to the classic method and do normal builds but on an old
distrib to dodge compatibility issues.

That would still be compatible with statically linking the more specific
libs, like e.g. z3.
2022-08-03 19:04:14 +02:00
Louis Gesbert
c964495c59 Generate website assets through dune 2022-08-03 19:04:13 +02:00
Louis Gesbert
1dbcc31599 Shell script tweaks 2022-08-03 19:03:27 +02:00
Louis Gesbert
0abbb3e29b Syntax: tweak priority of 'set contains elt'
(the other way around was creating a conflict !)
2022-08-02 10:02:03 +02:00
Emile Rolley
2da94b88c2 fix(compiler): use Plugin.extension instead of the hardcoded ".ml" one 2022-08-01 10:28:38 +02:00
Emile Rolley
1a6934b538 feat(build): add the generation of json schemas to the build workflow 2022-07-29 18:47:42 +02:00
Emile Rolley
21af0c8c04 refactor(compiler): split web plugin into api_web and json_schema + factorize some util functions 2022-07-29 18:42:47 +02:00
Emile Rolley
26663f227d fix(plugins/web): fix enum payload + retrieve all required types 2022-07-29 18:42:47 +02:00
Emile Rolley
ae3852fa12 feat(plugins/web): generate minimal working JSON schema from a given scope 2022-07-29 18:42:41 +02:00
Emile Rolley
599126a7ce feat(plugins/web): retrieve required types definitions from scope input 2022-07-29 18:42:41 +02:00
Emile Rolley
32ec53d918 refactor(plugins): jsoo -> web 2022-07-29 18:42:41 +02:00
Emile Rolley
6ce6ea8afc refactor(plugins): add scope as argument for the apply function 2022-07-29 18:42:41 +02:00
Emile Rolley
8e3fd34424 refactor(plugins/jsoo): encode Catala date in JS string object instead of date 2022-07-29 18:42:41 +02:00
Denis Merigoux
4845196b5b Add source positions in all backends exceptions 2022-07-29 18:42:14 +02:00
Denis Merigoux
974c2b8d58 Fix bug in Python backend 2022-07-28 15:02:43 +02:00
Denis Merigoux
d91ed27e28 The JS version of the housing benefits computation is working! 2022-07-28 15:02:43 +02:00
Emile Rolley
4f828c300e fix(jsoo): fix the translating of TUnit and TDuration to JSOO types 2022-07-28 15:02:43 +02:00
Denis Merigoux
8d3e283669 Fix some bugs of JSOO plugin 2022-07-28 15:02:43 +02:00
Louis Gesbert
3987e446e9
Add polish translation for new "contains" keyword 2022-07-28 10:34:37 +02:00
Louis Gesbert
6d41818e0a Change syntax for set membership predicate
Before: `ELEMENT in SET`; now: `SET contains ELEMENT`

Using the `in` keyword was causing conflicts and blocking #203.
Current proposal has `contient` for the French syntax, and is untranslated (`contains`) for Polish.
2022-07-27 14:34:58 +02:00
Louis Gesbert
922b77abc7 Cli: allow standard option --color=always|never|auto to control styling 2022-07-27 10:42:35 +02:00
Denis Merigoux
d17ac0bc39
More nitpicks 2022-07-22 18:04:16 +02:00
Denis Merigoux
fa55a83fb4
Merge branch 'master' into 290-jsoo-wrapper-plugin 2022-07-22 17:54:51 +02:00
Emile Rolley
d9045499c0 refactor(french_law/ocaml): refactor the api_web.ml 2022-07-22 17:01:33 +02:00
Emile Rolley
231f327efb feat(jsoo): v1 jsoo plugin 2022-07-22 16:52:56 +02:00
Emile Rolley
ad0efd3447 refactor(ocaml): wrap enum type inside their own module like struct ones 2022-07-22 16:52:56 +02:00
Emile Rolley
3ab5129572 feat(jsoo): add conversion fun generation (except mutiple cons args) 2022-07-22 16:52:56 +02:00
Emile Rolley
677ff92ae6 feat(utils): add File.ocamlformat_file_opt 2022-07-22 16:52:56 +02:00
Emile Rolley
5f27334bec feat(jsoo): gen conv functions from and to jsoo type 2022-07-22 16:52:56 +02:00
Emile Rolley
0a9e563450 refactor(to_ocaml): format_to_struct_type -> format_to_module_name 2022-07-22 16:52:56 +02:00
Emile Rolley
3dcf856ec6 refactor(cli): add Cli.call_unstyled 2022-07-22 16:52:56 +02:00
Emile Rolley
b2bba6eaf0 feat(jsoo): factorize log events related function to the object eventManager 2022-07-22 16:52:56 +02:00
Emile Rolley
37a8cf7090 fix(rebase): changes Lcalc and Dcalc AST manipulation according #272 2022-07-22 16:52:56 +02:00
Emile Rolley
0c180e12f9 refactor(runtimes): add runtime_ocaml and runtime_jsoo in the catala package 2022-07-22 16:52:56 +02:00
Emile Rolley
cd33ed9de7 feat(plugins/jsoo): now generate both .ml and _web_api.ml file 2022-07-22 16:52:56 +02:00
Emile Rolley
59f50f95e8 refactor(plugins/jsoo): use To_ocaml function directly by extending its interface 2022-07-22 16:52:56 +02:00
Emile Rolley
c09b457988 refactor(runtimes): add move the OCaml runtime into runtimes/ocaml 2022-07-22 16:52:56 +02:00
Emile Rolley
cda3bfb3aa feat(plugins/jsoo): format type declaration 2022-07-22 16:52:56 +02:00
Denis Merigoux
dc00ce8957
Merge branch 'master' into aides_logement 2022-07-22 16:49:01 +02:00
Denis Merigoux
b7c468bd1e
Fix faulty unboxing 2022-07-22 16:18:55 +02:00
Denis Merigoux
522deb50c2
Factorizing Dcalc.program 2022-07-22 15:49:57 +02:00
Denis Merigoux
0304602433 Trying to fix Bindlib unboxing bug [skip ci] 2022-07-22 12:31:05 +02:00
Denis Merigoux
85144c35fb Simplify default tree encoding 2022-07-22 12:31:02 +02:00
Denis Merigoux
3895743f20 Cleaned code for generating exception graph, now correct and fully general
Missing some encoding optimizations
2022-07-22 12:25:41 +02:00
Denis Merigoux
85cb2d5c8d Starting debug 2022-07-22 12:11:34 +02:00
Denis Merigoux
100c84a741
Allow negative literals 2022-07-21 14:14:22 +02:00
Denis Merigoux
dcf80f4bec
Adding first_day_of_month and last_day_of_month 2022-07-21 14:14:04 +02:00
Denis Merigoux
5bcee7ceba
Correctly generate HTML output 2022-07-20 15:35:26 +02:00
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
Denis Merigoux
fd7d9a6818
Add missing options 2022-05-26 19:10:53 +02:00
Denis Merigoux
ec225994af
Add "print_only_law" option 2022-05-26 19:05:06 +02:00
Louis Gesbert
cd70e16ea3 Compiler: simplify EDefault term at construction
This allows to match on their structure further on.
2022-05-25 18:36:07 +02:00
Louis Gesbert
2d41f53300 Compiler: add a few helper comparison functions
Adds syntactic comparison for some expressions, etc., allowing in
particular to detect syntactically equal expressions. Positions are,
obviously, ignored.
2022-05-25 18:35:57 +02:00
Louis Gesbert
4c43b533b0
Merge pull request #213 from AltGr/plugin-support
Add backend plugin support
2022-05-25 18:31:30 +02:00
Louis Gesbert
8124d4dab5 Compiler: add some doc on plugin support 2022-05-25 17:27:49 +02:00
Emile Rolley
92ebb4194b refactor(api_web/runtime): runtime_value derive yojson_of 2022-05-25 14:26:58 +02:00
Louis Gesbert
5ae4393004 Add two demo backend plugins
- one that is just the same as the python backend
- one that is a quick'n'dirty call to js_of_ocaml on top of the ocaml backend to
  generate js files

Use `make plugins` to test them. They are only expected to be useful as
demonstrations of how to write plugins.
2022-05-19 10:40:04 +02:00
Louis Gesbert
9a95a3554c Add support for backend plugins using dynlink 2022-05-19 10:40:02 +02:00
Emile Rolley
144704f7fb refactor(compiler): add the Utils.File module
+ Adds wrapper functions for formatter of file/out_channel
	and uses it in both the compiler and the clerk drivers.
2022-05-19 10:04:34 +02:00
Denis Merigoux
166355fad0
Merge pull request #260 from AltGr/parser-tweaks
An attempt to fix some parser priorities
2022-05-18 14:45:02 +01:00
Denis Merigoux
2781485c0a
Update compiler/literate/literate_common.ml
Co-authored-by: Louis Gesbert <louis.gesbert@ocamlpro.com>
2022-05-18 15:32:58 +02:00
Denis Merigoux
b2ca8e36aa
Corrections suggested by @Altgr 2022-05-18 15:32:13 +02:00
Louis Gesbert
faa5b32638 Merge remote-tracking branch 'origin/master' into allocations_logement 2022-05-12 15:22:17 +02:00
Louis Gesbert
f9fc1a8e8b Formatting: sync with master 2022-05-12 15:10:55 +02:00
Louis Gesbert
546347bbe2 Parser: allow chained if/then/else if/then/etc. 2022-05-11 19:26:34 +02:00
Louis Gesbert
05e3205fc9 Parser: priority tweaks
- makes sums and mults left-associative instead of right-associative (see the
  change in the tests!)
- uses higher priority for unary operators
2022-05-11 19:26:34 +02:00
Louis Gesbert
f17875f90e Formatting: some other personal preferences 2022-05-11 16:25:49 +02:00
Louis Gesbert
74c5629153 Formatting: reduce extra match-case indentation
2 is plenty enough, esp. for nested matches :)
2022-05-11 16:25:20 +02:00
Louis Gesbert
fa3693d813 Formatting: disable deprecated "smart" fun-decl option 2022-05-11 16:22:56 +02:00
Louis Gesbert
ac85d8dbb4 Upgrade ocamlformat version 2022-05-11 16:21:58 +02:00
Louis Gesbert
6cb0d581a6 Workaround some ocamlformat crashes
These files were not reformatted!
2022-05-11 16:21:07 +02:00
Louis Gesbert
6837af4e80 Upgrade Cmdliner dep 2022-05-09 11:39:18 +02:00
Denis Merigoux
96f1845afd
Merge branch 'master' into allocations_logement 2022-05-08 15:20:04 +02:00
Denis Merigoux
07198e326d
Fixed rounding bug in interpreter for negative values 2022-05-06 15:28:09 +02:00
Denis Merigoux
a52cc0d881
Move fix to lexer as suggested by @altgr 2022-05-06 10:29:39 +02:00
Denis Merigoux
080e60c25d
Fixes money cents parsing 2022-05-05 16:50:33 +02:00
Denis Merigoux
823c223ea8
Restore debug info 2022-05-05 16:28:17 +02:00
Denis Merigoux
025382a85d
Restore debug info 2022-05-05 14:34:29 +02:00
Denis Merigoux
a72944a3ec
Merge branch 'master' into allocations_logement 2022-05-05 14:27:48 +02:00
Denis Merigoux
c7b84ca2d0
Merge pull request #244 from CatalaLang/c_backend
Bringing structure to the Lcalc AST
2022-05-05 14:22:26 +02:00
Denis Merigoux
8a0d5d7916
Factoring, nitpicks and updates 2022-05-05 14:01:30 +02:00
Denis Merigoux
dd8956ea01
Use pandoc for HTML 2022-05-05 14:01:09 +02:00
Romain PRIMET
8b53445f8c
update generated catala import instruction 2022-05-05 14:01:09 +02:00
Denis Merigoux
d9da198740
Prettify family benefits 2022-05-05 14:00:44 +02:00
Denis Merigoux
e3e2e6c4e2
Better PDF 2022-05-04 14:01:24 +02:00
Denis Merigoux
1b439a09bd
Better LaTeX beginning [skip ci] 2022-05-02 16:20:39 +02:00
Denis Merigoux
5670546cc8
Fix lines too long 2022-05-02 16:20:39 +02:00
Romain PRIMET
75c67525d3 Merge remote-tracking branch 'upstream/master' into extract_py_runtime 2022-05-02 11:31:43 +02:00
Emile Rolley
ce2c7081b0 refactor(latex): print warning for too long lines + add instruction to compilation 2022-05-01 21:02:36 +02:00
Denis Merigoux
ad7fe6a21a
Use pandoc to prettify a lot the LaTeX document with tables 2022-04-29 23:47:02 +02:00
Denis Merigoux
2254527598
Corrige problème lexing arrondi en français 2022-04-29 21:41:52 +02:00
Denis Merigoux
d08dfb17d2
Corrige problème lexing arrondi en français 2022-04-29 21:41:20 +02:00
Denis Merigoux
aaa6a5d3a6
Merge branch 'master' into allocations_logement 2022-04-29 21:29:07 +02:00
Denis Merigoux
78e8275d5e
Adds a decimal rounding operator 2022-04-29 21:18:15 +02:00
Denis Merigoux
1bf4404bb3
Big refactoring of the APL code 2022-04-29 20:18:01 +02:00
Denis Merigoux
91cfcd9b56
Better PDFs 2022-04-29 12:55:09 +02:00
Denis Merigoux
741d151128
Correct indentation and sectionning + BMAF 2022-2023 [skip ci] 2022-04-29 10:50:46 +02:00
Denis Merigoux
6ec2938581
Subsubsubsections in LaTeX output 2022-04-29 10:25:46 +02:00
Denis Merigoux
3f3563cfeb
Print TOC in PDF 2022-04-28 13:32:35 +02:00
Denis Merigoux
d79e6c974d
Fix last bugs 2022-04-26 16:22:47 +02:00
Denis Merigoux
764edb6ef0
Refactoring finished 2022-04-26 16:06:36 +02:00
Denis Merigoux
6ea73a4291
Progress on refactoring [skip ci] 2022-04-26 12:07:39 +02:00
Denis Merigoux
40480fc4b0
Fix compile_with_exceptions [skip ci] 2022-04-25 18:00:08 +02:00
Denis Merigoux
3ded0c7399
Better error messages 2022-04-25 15:28:16 +02:00
Denis Merigoux
c1c2953131
Fixing more errors [skip ci] 2022-04-25 10:19:04 +02:00
Denis Merigoux
dca6a6c3d4
Merge branch 'master' into allocations_logement 2022-04-22 15:20:48 +02:00
Denis Merigoux
1c86c8298b
Fix decimal parsing 2022-04-22 14:26:28 +02:00
Denis Merigoux
d889397425
Write first computation test with @Lilyaslm! 2022-04-21 17:20:40 +02:00
Romain PRIMET
5397de576c update generated catala import instruction 2022-04-21 09:57:18 +02:00
Denis Merigoux
8ce81fedaa
Start to refactor Lcalc AST (WIP) [skip ci] 2022-04-15 12:16:44 +02:00
Denis Merigoux
88a522d120
Changed maps and folds for Dcalc 2022-04-15 12:16:22 +02:00
Denis Merigoux
4cd6d5519d
Fix doc generation 2022-04-14 11:18:26 +02:00
Denis Merigoux
6e03b512d9
Merge branch 'master' into allocations_logement 2022-04-13 15:28:54 +02:00
Denis Merigoux
8be3d1cfc9
Made more functions generic in Dcalc.Ast 2022-04-12 17:54:00 +02:00
Denis Merigoux
e7440e043c
Remove duplicated function 2022-04-12 17:07:00 +02:00
Denis Merigoux
33ff03a356
Map visitor for Dcalc 2022-04-12 11:51:33 +02:00
Denis Merigoux
b24dbc8360
Remove logging calls for vc generation 2022-04-12 11:14:39 +02:00
Denis Merigoux
48dda14dcd
Merge branch 'master' into c_backend 2022-04-12 10:53:46 +02:00
Denis Merigoux
a43f89a0f4
Parametrize Dcalc.scope_expr 2022-04-12 10:53:07 +02:00
Denis Merigoux
6f223d2519
Restore web build 2022-04-11 10:59:40 +02:00
Romain PRIMET
eafab30809 fix typo 2022-04-07 22:43:05 +02:00
Denis Merigoux
f2d1fab263
Refactoring to clean some Dcalc passes 2022-04-06 09:48:34 +02:00
Denis Merigoux
f6047a43ea
Added boxed constructors for Dcalc 2022-04-06 09:35:07 +02:00
Denis Merigoux
48b324c165
More comments 2022-04-04 18:12:19 +02:00
Denis Merigoux
cbd975d53a
Remove unused stub 2022-04-04 18:07:47 +02:00
Denis Merigoux
f6c8e7fbd9
Crediting author of moved code 2022-04-04 18:06:40 +02:00
Denis Merigoux
3f49824150
Merge branch 'master' into c_backend 2022-04-04 18:02:33 +02:00
Denis Merigoux
31e8f37a43
Sort VCs by alphabetical order 2022-04-04 17:51:41 +02:00
Denis Merigoux
e68fe42856
Put closure conversion prototype under a flag 2022-04-04 17:43:30 +02:00
Denis Merigoux
9d05dad3fb
Passing all tests! 2022-04-04 15:56:45 +02:00
Denis Merigoux
84144c0a56
Tests now passing except for a few position and printing issues [skip ci] 2022-04-04 12:25:00 +02:00
Denis Merigoux
7ca5ef283a
Code builds but bugguy [skip ci] 2022-04-04 08:56:48 +02:00
Denis Merigoux
2652b9c406
Continuing to adapt code to new binded representation [skip ci] 2022-04-02 14:51:11 +02:00
Denis Merigoux
8f39b65bb6
Started replacement of Ast by Binded_representation in Dcalc [skip-ci] 2022-04-02 12:29:43 +02:00
Denis Merigoux
be26fa2474
Implement app but lots of rtefactoring to do [skip ci] 2022-03-31 14:21:13 +02:00
Denis Merigoux
c7c774a1a1
Closure conversion: case of EAbs implemented 2022-03-31 12:19:31 +02:00
Denis Merigoux
6fb924b7d4
Merge pull request #236 from CatalaLang/afromher_z3
[Z3 encoding] Add support for durations
2022-03-28 19:08:11 +02:00
Denis Merigoux
158d49fe86
Removed unnecessary extra runtime function 2022-03-28 18:59:53 +02:00
Aymeric Fromherz
2b0206a5a8 Restrict duration z3 encoding to days only 2022-03-28 18:47:13 +02:00
Denis Merigoux
5d36af01e3
Restore the trace parameter functionality in the web interpreter 2022-03-28 15:16:03 +02:00
Denis Merigoux
ce7e756af1
Nice error messages for empty structs and enums 2022-03-28 14:43:38 +02:00
Aymeric Fromherz
2c247128d1 [Z3encoding] Add support for duration literals 2022-03-24 17:22:31 +01:00
Aymeric Fromherz
e2963bd7f3 Add a duration_to_nb_days function to runtime 2022-03-24 17:22:16 +01:00
Aymeric Fromherz
8d2348d1d9 [Z3 encoding] Add support for Duration type and operators 2022-03-24 17:15:22 +01:00
Denis Merigoux
be191de566
Some closures closed but buggy overall [skip ci] 2022-03-23 17:50:53 +01:00
Denis Merigoux
a660987df0
Starting to implement closure conversion [skip ci] 2022-03-21 17:26:23 +01:00
Denis Merigoux
25977de151
Prettify Scalc 2022-03-21 14:58:54 +01:00
Denis Merigoux
01bbf1230e
Merge branch 'master' into allocations_logement 2022-03-17 17:55:47 +01:00