Commit Graph

2416 Commits

Author SHA1 Message Date
Raphaël Monat
f60cfcc435 Merge branch 'master' of github.com:CatalaLang/catala into dates_calc_lib 2022-08-30 15:14:51 +02:00
Raphaël Monat
f337cebc4b Fix missing dependency for dune build 2022-08-30 15:06:53 +02:00
Raphaël Monat
39110f53a5 Fix missing case 2022-08-30 15:06:45 +02:00
Denis Merigoux
5bddde1c68
Fix documentation and test invocation 2022-08-30 13:48:20 +02:00
Denis Merigoux
60b98783f0
Make desugared and scopelang use the 'a mark type for AST annotations (#323)
Note: based upon #321 and should be rebased once that's merged

This gives further uniformity in their interfaces and allows more common
handling.

The next step will be for all the `Expr.make_*` functions to work on
expressions
annotated with the `'a mark` type, correctly propagating type
information when
it is present. Then we could even imagine early propagation of type
information (without complete inference), which could for example be
used for
overloaded operator disambiguation.
2022-08-29 16:00:07 +02:00
Denis Merigoux
1c3d5b9a75
Fix all lines too long problems & update assets 2022-08-29 15:46:06 +02:00
Denis Merigoux
e5963e5381
Merge branch 'master' into altgr_allmarks 2022-08-29 11:57:06 +02:00
Louis Gesbert
84c78a234f
Make desugared and scopelang use the 'a mark type for AST annotations
This gives further uniformity in their interfaces and allows more common
handling.

The next step will be for all the `Expr.make_*` functions to work on expressions
annotated with the `'a mark` type, correctly propagating type information when
it is present. Then we could even imagine early propagation of type
information (without complete inference), which could for example be used for
overloaded operator disambiguation.
2022-08-29 11:29:24 +02:00
Louis Gesbert
5bda9e98d0
Small cleanup
Remove unneeded types, e.g. provisions for scalc
2022-08-29 11:29:24 +02:00
Louis Gesbert
7e0d24efd2
Make all supertypes use ('a, 't) gexpr as parameter instead of naked_gexpr 2022-08-29 11:29:24 +02:00
Louis Gesbert
5e9c3d630e
Same treatment for typ and marked_typ 2022-08-29 11:29:24 +02:00
Louis Gesbert
f09451bf6b
Add a type alias for clarity of Shared_ast.Expr 2022-08-29 11:29:24 +02:00
Louis Gesbert
be58610061
Rename marked_expr -> expr, expr -> naked_expr throughout
Since the marked kind is used throughout, this should be more clear
2022-08-29 11:29:23 +02:00
Louis Gesbert
8f7ba5ccaf
Rename marked_gexpr -> gexpr, gexpr -> naked_gexpr
Since the marked kind is used throughout, this should be more clear
2022-08-29 11:29:23 +02:00
Denis Merigoux
fe0e34e991
Rename lots of types (#322)
Ok this one seems big but it's mostly just `sed` calls. It's very
optional. It's based on #321 so that should definitely be merged first.

For handling marks we usually have two mutually recursive types `foo`
and `marked_foo`. Types, expressions, etc.

Now, throughout, I found that we use `marked_foo` much more often than
`foo` when using the type. Which is good.

But I feel the naming pushes in favor of using the base `foo` type. So
this proposal does a little inversion:

- `marked_foo` → is renamed to → `foo` for use throughout
- `foo` → is renamed to → `naked_foo` for clarity
2022-08-29 11:28:12 +02:00
Louis Gesbert
e10771c187
Make all supertypes use ('a, 't) gexpr as parameter instead of naked_gexpr 2022-08-29 10:57:21 +02:00
Louis Gesbert
a9c8bab2b3
Same treatment for typ and marked_typ 2022-08-29 10:57:21 +02:00
Louis Gesbert
15dfef9809
Add a type alias for clarity of Shared_ast.Expr 2022-08-29 10:57:21 +02:00
Louis Gesbert
0a23dc526d
Rename marked_expr -> expr, expr -> naked_expr throughout
Since the marked kind is used throughout, this should be more clear
2022-08-29 10:57:21 +02:00
Louis Gesbert
493b6703a7
Rename marked_gexpr -> gexpr, gexpr -> naked_gexpr
Since the marked kind is used throughout, this should be more clear
2022-08-29 10:57:21 +02:00
Denis Merigoux
aaca280ccc
Continuing the AST factorisation to scopelang and desugared (#321)
(on top of #320, waiting for it to be merged for rebase)
2022-08-29 10:54:17 +02:00
Denis Merigoux
538cca3f0e
Fix table 2022-08-26 12:05:22 +02:00
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
79677063d8
Rationalise the tuple / enum types (#320)
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-26 11:29:58 +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
e6f560675f
Follow-up on the AST factoring (#318)
After the tedious part comes the cool stuff: reducing the number of code lines!
2022-08-23 13:39:39 +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
9008a7f0e6
Improving French housing benefits (#314)
Follow-up of #287, #266 and #165.
Time spent
Pair programming sessions

Before 2022-07-11: 50h (50 h for each person of the pair programming duo)

Refactoring sessions

Before 2022-07-11: 24 h
2022-07-14: 3 h

Legal research sessions

Before 2022-07-11: 21,5 h

Testing and debugging

Before 2022-07-11: 13,5 h
2022-07-11: 3 h with Denis
2022-07-13: 2 h with Denis
2022-07-14: 1 h with Denis
2022-07-16: 2 h with Denis
2022-07-19: 2 h with Denis
2022-07-21: 2 h with Denis
2022-08-11: 6 h with Denis
2022-08-15: 4 h with Denis
2022-08-16: 2 h with Denis

UI and form

2022-08-09: 8 h with Denis
2022-08-10: 8 h with Denis
2022-08-15: 2 h with Denis
2022-08-16: 2 h with Denis
2022-08-17: 6 h with Denis
2022-08-18: 4 h with Denis
2022-08-19 14:57:48 +02:00
Denis Merigoux
b5c4608ce1
Message 2022-08-19 14:43:56 +02:00
Denis Merigoux
a804199c34
Add test for precedence of local variabes vs. local scopes (#319)
Ref. #317
2022-08-19 12:29:44 +02:00
Denis Merigoux
062fea89d7
No RLS for logement-foyers 2022-08-19 11:54:15 +02:00
Denis Merigoux
d6ad4604ce
Only social conventions for logement-foyers 2022-08-19 11:39:04 +02:00
Louis Gesbert
d9c1426c66 Add test for precedence of local variabes vs. local scopes
Ref. #317
2022-08-19 11:08:28 +02:00
Raphaël Monat
0b73fbbac4 Add support for first and last day of month operators 2022-08-18 21:22:50 +02:00