Commit Graph

85 Commits

Author SHA1 Message Date
Louis Gesbert
4910158aea Reformat 2023-09-01 16:24:27 +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
fe9143a304
More complete runtime 2023-08-04 16:50:00 +02:00
Denis Merigoux
f28a1a8a90
Ported Catala runtime to R 2023-08-04 15:21:19 +02:00
Micah Cantor
3b1c23c054 add explicit yojson open 2023-08-02 12:17:28 +02:00
Louis Gesbert
8920564f9e Fix some documentation comments formatting 2023-07-04 10:01:51 +02:00
Louis Gesbert
89e90271c1 Implement an additional localised, user-facing value printer 2023-07-03 16:42:54 +02:00
Louis Gesbert
0f9ee2c72e Refacter the main Driver module
- Use separate functions for successive passes in module `Driver.Passes`
- Use other functions for end results printing in module `Driver.Commands`

As a consequence, it is much more flexible to use by plugins or libs and we no
longer need the complex polymorphic variant parameter.

This patch leverages previous changes to use Cmdliner subcommands and
effectively specialises the flags of each Catala subcommand.

Other changes include:

- an attempt to normalise the generic options and reduce the number of global
  references. Some are ok, like `debug` ; some would better be further cleaned up,
  e.g. the ones used by Proof backend were moved to a `Proof.globals` module and
  need discussion. The printer no longer relies on the global languages and prints
  money amounts in an agnostic way.
- the plugin directory is automatically guessed and loaded even in dev setups.
  Plugins are shown by the main `catala` command and listed in `catala --help`
- exception catching at the toplevel has been refactored a bit as well; return
  codes are normalised to follow the manpage and avoid codes >= 128 that are
  generally reserved for shells.

Update tests
2023-07-03 16:42:54 +02:00
Louis Gesbert
e224e87f71 Wip support for modules
(first working dynload test with compilation done by manual calls to ocaml)

A few pieces of the puzzle:

* Loading of interfaces only from Catala files
* Registration of toplevel values in modules compiled to OCaml, to allow access
  using dynlink
* Shady conversion from OCaml runtime values to/from Catala expressions, to
  allow interop (ffi) of compiled modules and the interpreter
2023-06-15 17:56:57 +02:00
Denis Merigoux
4612920bf4
Merge branch 'master' into more_infos_in_logs 2023-06-01 17:38:41 +02:00
Denis Merigoux
6b4693bb8b
Too much directory restriction 2023-05-30 14:06:52 +02:00
Denis Merigoux
94999dcc25
Correctly generate latex, nowrap option not working anymore? 2023-05-30 12:03:50 +02:00
Emile Rolley
16088a74ab pkg(rescript): @catala-lang/rescript-catala v0.8.1-b.0 2023-05-29 12:28:34 +02:00
Denis Merigoux
fa9f432e8b
Python runtime OK now 2023-05-26 17:08:26 +02:00
Denis Merigoux
8987d358e7
Implement the rest 2023-05-26 16:54:52 +02:00
Emile Rolley
86121308fe publish(runtimes/rescript): @catala-lang/rescript-catala v0.8.0 2023-05-07 15:13:22 +02:00
Emile Rolley
77b42d9e29 publish(runtimes/rescript): @catala-lang/rescript-catala v0.1.1 2023-05-07 15:13:22 +02:00
Emile Rolley
b4372a965d refactor(runtimes/rescript): rename Runtime into CatalaRuntime 2023-05-07 15:13:22 +02:00
Emile Rolley
2a39f1b5f8 feat(runtimes): add rescript-catala 2023-05-07 15:13:22 +02:00
adelaett
32b45984ab
remove serialization of runtime.ml values 2023-04-14 14:13:34 +02:00
adelaett
cc66023e51
Thunking justifications and conclusion in avoid_translation pass 2023-04-12 10:58:21 +02:00
alain
ec40de83fc
Merge branch 'master' into adelaett-withoutexceptionsfix 2023-04-06 13:57:22 +02:00
Denis Merigoux
7d278caa30
Update OCaml assets 2023-04-04 15:19:08 +02:00
adelaett
6dee3874cc Merge branch 'master' into adelaett-withoutexceptionsfix 2023-03-30 10:50:32 +02:00
Raphaël Monat
7021c41f93 Add date rounding option within scopes 2023-03-16 16:55:55 +01:00
Emile Rolley
b2383d33bc fix(runtimes/ocaml): rename fun_call.inputs into fun_call.fun_inputs 2023-03-11 17:37:24 +01:00
Louis Gesbert
42b8adb968 Add a duration / duration overload
Interstingly enough, it was already implemented in the Python backend.

Required to implement *pro rata temporis*, which the US tax section 121 does
make use of.

Only allowed for durations expressed in days (as returned by `<date> - <date>`),
of course.
2023-03-08 15:17:58 +01:00
adelaett
b5f3621302 serialization wip 2023-02-27 11:20:59 +01:00
adelaett
13685b3fce correct logs parsing in the runtime 2023-02-24 12:04:45 +01:00
adelaett
5000057dde new parser/formater in runtimes/ocaml/runtime.ml 2023-02-23 17:17:25 +01:00
Denis Merigoux
830ec0e60c
Python runtime: Fix source positions linked to run-time errors (#401) 2023-02-21 10:27:01 +01:00
Rohan Padhye
940485dca4
Python runtime: Money division can simply use Integer division to remain rational
This is cleaner than referencing `mpq` explicitly, as it still returns a `Decimal` with full rational (non-floating) precision.
2023-02-20 22:40:05 -05:00
Rohan Padhye
6c1963e7dd
Python runtime: Money division should remain rational
Fixes #402
2023-02-20 22:34:03 -05:00
Rohan Padhye
e7a331a2ae Python runtime: Fix source positions linked to run-time errors 2023-02-20 15:49:53 -05:00
Rohan Padhye
4c9bff1b74 Python backend: Date difference should always return duration in days 2023-02-14 13:48:19 -05:00
Denis Merigoux
b3057e1d7c
Continue cleaning 2023-01-07 20:42:42 +01:00
Denis Merigoux
2f4a51ce64
Bug fixed! It was tricky 2023-01-07 20:22:36 +01:00
Denis Merigoux
c723249337
Managed to find a MWE of the bug 2023-01-06 17:07:43 +01:00
Louis Gesbert
f236e2cfb2 Replace the type conversion and rounding operators with overloads
Ref. #366

Also updates `CONTRIBUTING.md`.

This was pretty straight-forward :)
2022-12-13 15:32:49 +01:00
Louis Gesbert
c94509e0bb Remove integer division from the language
it's unlikely to be used in any law, and likely to be cause for confusion.

best of all, the new operator has a different return type, which
ensures no inconsistency with the change can get overlooked.
2022-12-13 12:35:02 +01:00
Louis Gesbert
9b939d07a4 New syntax for collection operations 2022-12-13 12:30:40 +01:00
Louis Gesbert
fea01cfe4c Add overloaded operators for the common operations
This uses the same disambiguation mechanism put in place for
structures, calling the typer on individual rules on the desugared AST
to propagate types, in order to resolve ambiguous operators like `+`
to their strongly typed counterparts (`+!`, `+.`, `+$`, `+@`, `+$`) in
the translation to scopelang.

The patch includes some normalisation of the definition of all the
operators, and classifies them based on their typing policy instead of
their arity. It also adds a little more flexibility:
- a couple new operators, like `-` on date and duration
- optional type annotation on some aggregation constructions

The `Shared_ast` lib is also lightly restructured, with the `Expr`
module split into `Type`, `Operator` and `Expr`.
2022-12-13 11:55:24 +01:00
Denis Merigoux
0beaf6eb31
Comparing with Catala! 2022-09-26 17:29:05 +02:00
Denis Merigoux
32c89cc3a2
Fix Python backend for housing benefits 2022-09-26 13:28:07 +02:00