Commit Graph

583 Commits

Author SHA1 Message Date
Louis Gesbert
2f2924944a Syntax: add keywords in front of list filtering / arg-extremum
Closes #574
2024-02-14 13:55:03 +01:00
Louis Gesbert
bf0ef0b1f5 Allow access to intermediate variable states
Through the syntax `var_name state state_name`.

Addresses #567, but
- requires documentation
- explicitely accessing states of the variable being defined is not allowed at
  the moment (warning proposed in #567 requires a whole-expression check, which
  is better done some place else entirely)
2024-02-12 18:15:48 +01:00
Louis Gesbert
36866a919b Tests: remove redundant part in filenames 2024-02-12 18:03:16 +01:00
Louis Gesbert
e308ff8d02 Generalise the definition of lists of nested binders 2024-02-09 18:33:41 +01:00
Louis Gesbert
82fb66daef Clerk: fix options passed to catala in out-test mode 2024-02-09 10:54:58 +01:00
Louis Gesbert
12974b089f Printer: skip unit variables for conciseness 2024-02-07 17:54:12 +01:00
Louis Gesbert
61c105c365 Add one more trivial optimisation 2024-02-05 11:01:55 +01:00
Louis Gesbert
5cb8ba805b List detuplification: better intermediate vars namings
for more readable code
2024-02-05 11:01:55 +01:00
Louis Gesbert
7b43f393c5 Add some optimisations to nested maps 2024-02-05 11:01:55 +01:00
Louis Gesbert
54ca62a78e Fix definition and usage of the C backend test
(including fix of Clerk about "legacy tests")
2024-02-01 15:59:45 +01:00
Louis Gesbert
5d233f4532 Fix warning 2024-01-29 11:37:42 +01:00
Denis Merigoux
a033f02689
Restore tests 2024-01-29 11:06:48 +01:00
Denis Merigoux
b48fb0e223
Array compilation to C is OK 2024-01-26 20:15:32 +01:00
Denis Merigoux
a39b67bf12
Merge branch 'master' into c_backend 2024-01-26 17:43:07 +01:00
Louis Gesbert
371f9554b8 Support for list recombinations
The primary use-case for this was to be able to run computations on a list of
structures, then return an updated list with some fields in the structures
modified : that is what we need for distribution of tax amounts among household
members, for example.

This patch has a few components:

- Addition of a test as an example for tax distributions

- Added a transformation, performed during desugaring, that -- where lists are
  syntactically expected, i.e. after the `among` keyword -- turns a (syntactic)
  tuple of lists into a list of tuples ("zipping" the lists)

- Arg-extremum transformation was also fixed to use an intermediate list instead
  of computing the predicate twice

- For convenience, allow to bind multiple variables in most* list
  operations (previously only `let in` and functions allowed it)

- Fixed the printer for tuples to differentiate them from lists

*Note: tuples are not yet allowed on the left-hand side of filters and
arg-extremums for annoying syntax conflict reasons.
2024-01-26 11:29:33 +01:00
Louis Gesbert
a9f8fa36b8 Reduce default verbosity of invariant checks
they break the tests too often for no good reason
2024-01-25 18:18:43 +01:00
Denis Merigoux
8a139f6a3c
Work on arrays 2024-01-22 16:49:58 +01:00
Louis Gesbert
c336a7bb62
[WIP] Rehaul CI to run examples and generate artifacts again (#562) 2024-01-19 18:34:24 +01:00
Louis Gesbert
1c2c41b2ff Allow literal scope output structures 2024-01-19 15:43:35 +01:00
Louis Gesbert
d9a17db4c0 Fix running inline tests
Warning: one of them is broken and was disabled
2024-01-18 16:14:27 +01:00
Denis Merigoux
50d3164f36
Restore C compilation 2024-01-17 17:26:41 +01:00
Denis Merigoux
349da741d4
Merge branch 'master' into c_backend 2024-01-16 16:23:35 +01:00
Louis Gesbert
8ed45c2762
Fixes missing minus sign printing for small negative amounts of money (#560) 2024-01-16 12:21:29 +01:00
Denis Merigoux
15c7691c09
Fixes #555 2024-01-16 11:40:10 +01:00
Denis Merigoux
b616e60c79
Fixes #558 2024-01-16 11:29:45 +01:00
Denis Merigoux
9f03b6b931
Merge branch 'master' into c_backend
Some tests still failing...
2024-01-15 17:19:17 +01:00
Pierre Goutagny
6a39d066f2
Unify rounding operations in OCaml runtime 2024-01-10 13:43:19 +01:00
Louis Gesbert
12f208b3fc Adding tuples: fixes following review 2024-01-08 12:16:07 +01:00
Denis Merigoux
a9764d607e
Merge branch 'master' into c_backend 2023-12-19 17:39:02 +01:00
Louis Gesbert
5384394a72 Fix typing upon detuplification 2023-12-19 17:30:32 +01:00
Louis Gesbert
a2efc94fd2 Register the option type in ctx when used in lcalc 2023-12-19 17:30:28 +01:00
Denis Merigoux
6520d4863e
Restore tests 2023-12-19 17:29:37 +01:00
Louis Gesbert
a1c1a7756f Update invariant tests outputs 2023-12-19 17:27:44 +01:00
Louis Gesbert
94ebc1b65e Allow deconstruction of tuples using let in 2023-12-19 17:25:44 +01:00
Louis Gesbert
fb51f58261 Optimise away trivially-true errors-on-empty 2023-12-19 16:10:11 +01:00
Louis Gesbert
ea4e191f27 Add optimisation to skip variable aliasings
This particularly of effect to the code introduced by closure conversion.
2023-12-19 16:07:22 +01:00
Louis Gesbert
7233ec403a Printer: add parens after constructors 2023-12-19 16:07:22 +01:00
Louis Gesbert
e123d7eb95 Change type syntax of collection into list of 2023-12-19 15:26:44 +01:00
Louis Gesbert
3779a249db Unify all CLI arguments to use - rather than _
it's more common on UNIXes and the mix was unpleasant.
2023-12-19 15:25:37 +01:00
Denis Merigoux
9358ad945e
Better type translation in closure conversion 2023-12-19 14:31:57 +01:00
Denis Merigoux
14589010a0
Restore tests 2023-12-19 14:13:42 +01:00
Denis Merigoux
50a9e15906
Restore tests 2023-12-19 13:59:40 +01:00
Denis Merigoux
366c351930
Correctly compiles let bindings in expressions 2023-12-19 12:03:23 +01:00
Denis Merigoux
4eead4850b
There are no more defaults in type after compile_with_exceptions... 2023-12-18 15:14:28 +01:00
Denis Merigoux
91f8451899
Better beta-reduction 2023-12-18 14:49:43 +01:00
Denis Merigoux
35f829cd65
Fix default optimisation 2023-12-18 14:42:58 +01:00
Denis Merigoux
10d8c0b19f
Ignore files 2023-12-13 17:13:25 +01:00
Denis Merigoux
fe5b842a03
Simple example compiles and runs fine 2023-12-13 16:58:02 +01:00
Denis Merigoux
1f91c16e43
Fix little bug 2023-12-13 16:40:22 +01:00
Denis Merigoux
9198fe2514
Restore tests: more typing now 2023-12-12 13:52:57 +01:00