Louis Gesbert
eeaadef27c
Output subscopes: implement syntax
...
required a little generalisation and explicit parsing errors to avoid conflicts,
but it remains reasonable
2024-04-04 10:24:18 +02:00
Louis Gesbert
dc6bfae75c
Fixes for linking modules in the backends (in particular, Python)
2024-03-08 17:36:00 +01:00
Louis Gesbert
20c1dee5cb
Tests: add catala test-scope
pseudo-command for inline tests
2024-02-26 14:56:43 +01:00
Louis Gesbert
97ae62384e
Add externals to scalc, working test with Python backend
2024-02-26 14:56:43 +01:00
Louis Gesbert
4ee4992b54
Tweak multi-module LaTeX output
2024-02-16 16:36:15 +01:00
Louis Gesbert
18ec4b3dd3
LaTeX backend: fix module name escaping
2024-02-15 20:54:14 +01:00
Louis Gesbert
eb4ba114d2
Add test for literate LaTeX output
2024-02-15 14:53:26 +01:00
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
Denis Merigoux
1d4119c3a3
Simple test
2023-12-11 13:26:13 +01:00
Louis Gesbert
509ce9788a
Document and first test for externals ( #538 )
2023-12-07 16:06:25 +01:00
adelaett
f63c3d3fc3
fix error in a test
2023-12-07 11:27:14 +01:00
adelaett
d7327e53c0
/!\ problematic tests
2023-12-07 11:27:14 +01:00
adelaett
a69776e6b5
checking invariants on all tests as well as on social benefits of french law
2023-12-07 11:27:14 +01:00
Louis Gesbert
7160093682
Allow scope execution in compiled ocaml executables
2023-12-06 11:06:54 +01:00
Louis Gesbert
9a255522be
Document and first test for externals
...
Also some fixes for Clerk to properly support them
2023-12-06 11:06:54 +01:00
Louis Gesbert
e689f0c47b
Small cleanup and doc on the module handling refactor
2023-12-05 16:01:56 +01:00
Louis Gesbert
8df49dcea2
More tests and some fixes
2023-11-30 23:49:19 +01:00
Louis Gesbert
3649f92975
Rework resolution of module elements
...
This changes the `decl_ctx` to be toplevel only, with flattened references to
uids for most elements. The module hierarchy, which is still useful in a few
places, is kept separately.
Module names are also changed to UIDs early on, and support for module aliases
has been added (needs testing).
This resolves some issues with lookup, and should be much more robust, as well
as more convenient for most lookups.
The `decl_ctx` was also extended for string ident lookups, which avoids having
to keep the desugared resolution structure available throughout the compilation
chain.
2023-11-30 21:14:12 +01:00
Louis Gesbert
86b7f80e90
Clerk improvements
...
- Add a `-I` option that allows defined modules to be available from other
directories
- Add reporting of the number of successful / failed tests
- Locate the project root, and always run the commands from there
2023-11-30 21:14:12 +01:00
Louis Gesbert
4e465d2b48
Printer: some small improvements
2023-11-28 13:37:46 +01:00
Louis Gesbert
447f6d41f1
Interpreter: fix execution with closure_conversion
...
and context variables
2023-11-28 13:37:46 +01:00
Louis Gesbert
645c263ccc
Fix closure-conversion
...
Joint debugging with @denismerigoux :)
2023-11-28 11:18:41 +01:00
Louis Gesbert
80475ad5ef
Printer: show toplevel uids in debug mode
...
otherwise we had an inconsistency between what's defined at toplevel and what
appears in expressions.
2023-11-28 11:15:01 +01:00
Louis Gesbert
35b40785c7
Update tests (lcalc+avoid_exceptions outputs changed)
2023-11-27 11:17:38 +01:00
adelaett
8a85e7b78f
typing defaults: update passing tests
2023-11-27 11:17:38 +01:00
adelaett
dda09f0cc1
typed defaults: update passing tests.
2023-11-27 11:17:34 +01:00
adelaett
f6027109d8
Typed default: Update passing tests
...
For now, most tests involving only one scope and no context do pass.
More work is required for the rest.
2023-11-27 11:12:26 +01:00
Louis Gesbert
cc4e5339dd
Typed defaults: small simplification and fixes
2023-11-27 11:09:08 +01:00
Louis Gesbert
1efda5ca22
Typing defaults: support nested priorities
...
The way nested priorities are encoded use `< < excs | true :- nested > :- x >`,
which imply that `nested` can actually be ∅ ; to cope with this, the typing of
default terms is made more generic (the return type is now the same as the
`cons` type `'a`, rather than `<'a>`). For the general case, we add an explicit
`EPureDefault` node which just encapsulates its argument (a `return`, in monad
terminology).
2023-11-27 11:09:08 +01:00
Louis Gesbert
bcf285913e
Typing the HandleDefault operator
2023-11-27 11:06:33 +01:00
Louis Gesbert
dc3ffa0dcd
Fix some error handling on scope calls
...
(and add suggestions)
2023-11-27 11:06:33 +01:00
Louis Gesbert
d00cac09ad
Harmless test results changes
2023-11-27 11:06:33 +01:00
Louis Gesbert
e2730c0b44
Avoid redundant position in type error
2023-11-27 11:05:58 +01:00
Denis Merigoux
c46f5d568d
Don't put a box in list printing but do indent ( #524 )
...
Don't put a box in list printing but do indent
2023-11-02 11:56:57 +01:00
Louis Gesbert
1d8e3748ea
Improving the printer on arrays
2023-11-02 11:12:51 +01:00
Louis Gesbert
73df41eb6f
More complete tests on module calls and a bunch of fixes ( #525 )
2023-10-17 09:42:48 +02:00
Louis Gesbert
f25e38a6d7
Add complete scope call tests (across modules)
2023-10-13 16:12:19 +02:00
Louis Gesbert
61ec34e3d9
Fix handling of context vars with all call cases
2023-10-12 14:47:43 +02:00
Louis Gesbert
f8b6e60e16
Fix handling of context variables in the interpreter
2023-10-12 14:42:57 +02:00
Denis Merigoux
9024cf1222
Don't put a box in list printing but do indent
2023-10-12 12:01:28 +02:00
Denis Merigoux
74684899c8
If you've in debug mode we can argue you want to see functions
2023-10-11 10:00:09 +02:00
Louis Gesbert
2c6e6bf0b5
Disambiguate constructors and fields across modules
2023-10-03 18:49:00 +02:00
Louis Gesbert
22045a2f06
Tests and fixes on structures across modules
2023-10-03 18:43:14 +02:00
Louis Gesbert
cc7c3fc18c
Clerk: add more tests, and small fixes
2023-10-02 17:51:16 +02:00
Louis Gesbert
5efa61a0ce
Clerk: rewrite 'clerk runtest' to use the new lightweight lexer
...
* Obsolete code for included tests has been removed
* The engine uses a proper lexer and is much simplified
* An inline test in the middle of the file now only "sees" the file up to that
point. This fixes an issue where we had spurious errors when a type error was
added at the end of a file, and it would pop up in tests before it. This makes
files including many tests much more practical.
* diffing and resetting the tests has been reintroduced (done at the moment in
Ninja, but for more control (count number of failed tests, etc.) we could put it
back into Clerk at some point
* The Catala CLI can now take an input from stdin (with the possibility to link
a (possibly fake) on-disk file for error reporting and file locations ; this
is useful for running tests)
2023-09-27 13:18:18 +02:00
Louis Gesbert
442997aea5
Clerk: rework CLI to use subcommands
2023-09-27 13:14:08 +02:00
Louis Gesbert
f162f6e9bd
Improve handling of module name definitions
...
and add some sanity-checks for consistency of used modules w.r.t. actually
loaded modules.
2023-09-27 13:14:03 +02:00
Louis Gesbert
22c69938b6
Fix handling of "output" tests
...
I.e. our legacy tests with a separate output tests, to distinguish from inline
tests.
2023-09-27 13:08:15 +02:00
Louis Gesbert
63773e48b5
Update tests outputs
2023-09-27 13:08:15 +02:00
Louis Gesbert
f8e3774662
Fix lookup of built modules in Catala
2023-09-27 13:08:15 +02:00
Louis Gesbert
60fe40e25b
Clerk: fix some module linking options
2023-09-27 13:08:15 +02:00