Commit Graph

3710 Commits

Author SHA1 Message Date
Louis Gesbert
6855870f02
Add tuples to the surface language, allow tuples for argument passing (#554) 2024-01-08 13:20:11 +01:00
Louis Gesbert
12f208b3fc Adding tuples: fixes following review 2024-01-08 12:16:07 +01:00
Louis Gesbert
d3e7c565a9 Closure conversion: use multiple let-in 2023-12-19 17:30:32 +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
Louis Gesbert
a1c1a7756f Update invariant tests outputs 2023-12-19 17:27:44 +01:00
Louis Gesbert
2823795f9f AST change: more specific application
As part of making tuples first-class citizens, expliciting the arity upon
function application was needed (so that a function of two args can
transparently -- in the surface language -- be applied to either two arguments
or a pair).

It was decided to actually explicit the whole type of arguments because the cost
is the same, and this is consistent with lambda definitions.

A related change done here is the replacement of the `EOp` node for operators by
an "operator application" `EAppOp` node, enforcing a pervasive invariant that
operators are always directly applied. This makes matches terser, and highlights
the fact that the treatment of operator application is almost always different
from function application in practice.
2023-12-19 17:27:40 +01:00
Louis Gesbert
94ebc1b65e Allow deconstruction of tuples using let in 2023-12-19 17:25:44 +01:00
Louis Gesbert
df3ab64fe9 Add tuples to the surface language
No helpers to destruct them at the moment
2023-12-19 17:25:44 +01:00
Louis Gesbert
50730ab8ff
Small optimisations (#553) 2023-12-19 17:17:36 +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
ad0afa2f64 Small interpreter optimisation
This is unholy, but we're manually bringing a typing proof so it may be
acceptable...
2023-12-19 16:07:22 +01:00
Louis Gesbert
50cb0db890
[breaking changes] update syntax and CLI (#546) 2023-12-19 16:05:51 +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
b50db59f50
Fixes decimal user-facing printer bug (#552) 2023-12-19 15:00:09 +01:00
Denis Merigoux
14589010a0
Restore tests 2023-12-19 14:13:42 +01:00
Denis Merigoux
e6a35f31b6
Fixes #551 2023-12-19 13:39:24 +01:00
Emile Rolley
a0ec4f8aff fix(french-law): move deps in dev 2023-12-13 13:58:26 +01:00
Emile Rolley
0e4b108882 pkg(french-law): published new patch for @catala-lang/french-law (v0.8.11) 2023-12-13 11:42:47 +01:00
Denis Merigoux
6f3679d8ca
Refactor AL example and improve the website-assets generation workflow (#550) 2023-12-11 11:31:07 +01:00
Denis Merigoux
e2aeb49a9b
Correct fix 2023-12-11 10:44:25 +01:00
Emile Rolley
a809410338 refactor(build): run example.js after compiling french_law.js 2023-12-08 16:10:18 +01:00
Louis Gesbert
11654d88b8
Small module-handling fixes (#545) 2023-12-08 15:35:41 +01:00
Louis Gesbert
5b1462d529 Clerk: allow to include non-yet-existing directories
Useful when you have wide `-I` options that not all targets may depend on.
2023-12-08 13:56:31 +01:00
Louis Gesbert
a988ad473b Fix handling of embedded context through modules
Exceptions raised by the interpreter from within the native modules were not
handled correctly.
2023-12-08 13:56:18 +01:00
Denis Merigoux
08661a50d3
More explanation-friendly code 2023-12-08 11:24:56 +01:00
Louis Gesbert
509ce9788a
Document and first test for externals (#538) 2023-12-07 16:06:25 +01:00
Louis Gesbert
10ba1d6e7b
Adelaett invariant typing default (#541) 2023-12-07 15:02:20 +01:00
adelaett
b5e7b297aa
typo fixing 2023-12-07 13:48:46 +01:00
adelaett
9f4a238a4a
Fix error messages for unexpected types.
do not retype the terms in the cases where checking invariant is not mandatory.
2023-12-07 13:45:50 +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
adelaett
934ab328ec
invariant checking is now available without printing the ast using the typecheck subprogram 2023-12-07 11:27:14 +01:00
adelaett
e1bda33e07
fmt 2023-12-07 11:27:14 +01:00
adelaett
030705eacd
Make the typing invariant more precise. 2023-12-07 11:27:14 +01:00
adelaett
67e36dcf42
Adding Typing Invariant for TDefault
Added a new type safety invariant to ensure that the type `TDefault` can only appear in certain positions,

* On the left-hand side of an arrow with arity 1, as the type of a scope (for scope calls).
* At the root of the type tree (outside a default).
* On the right-hand side of the arrow at the root of the type (occurs for rentrant variables).

This is crucial to maintain the safety of the type system, as demonstrated in the formal development.

The invariant was checked on all tests cases and on family and housing benefits.

Adjusted inversion invariant about app to handle external objects as well.
2023-12-07 11:27:14 +01:00
Denis Merigoux
2486fbcfb5
Fix LaTeX weaving failing with code blocks (#544) 2023-12-07 11:08:04 +01:00
Denis Merigoux
628cbc4fec
Fix #543 2023-12-06 16:58:38 +01:00
Louis Gesbert
7160093682 Allow scope execution in compiled ocaml executables 2023-12-06 11:06:54 +01:00
Louis Gesbert
54d956823b Some module fixes 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
0d5759d99c Allow pre-declarations without an expression for topdefs
it allows for better splitting between metadata and code (even if the type has
to be repeated at the moment)
2023-12-05 16:21:04 +01:00
Louis Gesbert
14cbe07d18
Clerk and testing improvements, rework resolution of module elements (#535) 2023-12-05 16:18:46 +01:00
Louis Gesbert
e689f0c47b Small cleanup and doc on the module handling refactor 2023-12-05 16:01:56 +01:00
Denis Merigoux
f71f253cb5
Update CI badge 2023-12-05 15:19:42 +01:00
Louis Gesbert
cc8ca9682e
Remove the nix CI (#542) 2023-12-05 14:01:27 +01:00