Commit Graph

1269 Commits

Author SHA1 Message Date
Louis Gesbert
fd50e6186f Fix default typing across modules 2023-11-27 11:06:33 +01:00
Louis Gesbert
9203e4f7bb Verification: support unboxed defaults 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
958aaebac3 Typing defaults fixes: keep in and out type in scope sigs 2023-11-27 11:06:16 +01:00
Louis Gesbert
ab6bec390d Adjust plugins and warnings 2023-11-27 11:06:16 +01:00
Louis Gesbert
0be2636e65 Typing defaults: making the compiler adhere to the new type discipline 2023-11-27 11:06:01 +01:00
Louis Gesbert
52486af6ac Correct typing of context subscope variables 2023-11-27 11:06:01 +01:00
Louis Gesbert
b98bad8c33 Add a --no-typing option
it is useful e.g. to be able to print intermediate ASTs when they don't type, to
debug the typing errors. This is better than commenting the typing line each
time.

Note that the option is not available on all targets (esp. not for ocaml and
python outputs ; it's allowed on the interpreters for debugging purposes but I'm
not sure if that's a good idea)
2023-11-27 11:06:01 +01:00
Louis Gesbert
9425753eca Typer: add built-in "'a default" type 2023-11-27 11:06:01 +01:00
Louis Gesbert
e2730c0b44 Avoid redundant position in type error 2023-11-27 11:05:58 +01:00
Louis Gesbert
4fa9326618 Typer: on error, print the expression being typed in debug mode
useful when typing fails on internally generated expressions
2023-11-27 11:03:47 +01:00
Denis Merigoux
fc242a5d1f
Fix Python compilation and runtime 2023-11-22 18:08:44 +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
bd90555e96 The interpreter might return custom terms
since scope outputs may contain functions this shouldn't be excluded; functions
from the interpreter now reflect this
2023-10-13 16:16:45 +02:00
Louis Gesbert
3b0e576a24 Fix module name propagation 2023-10-13 16:13:02 +02:00
Louis Gesbert
2d062a4ad0 Fix bug in dependency analysis around scope call arguments 2023-10-13 16:12:15 +02:00
Louis Gesbert
d09113163d Fix bug in dependency analysis around scope call arguments 2023-10-13 15:09:36 +02:00
Louis Gesbert
61ec34e3d9 Fix handling of context vars with all call cases 2023-10-12 14:47:43 +02:00
Louis Gesbert
af8ff472a5 Fix handing of context variables in modules
The call convention imposes a translation of their types within the scope input
structs definitions in dcalc.
2023-10-12 14:42:57 +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
fce192be20
Improve trace printing 2023-10-11 09:37:36 +02:00
Louis Gesbert
2708fa53b2 Reformat 2023-10-03 18:50:18 +02:00
Louis Gesbert
263cf3a9f7 Fix line-lexer on french syntax
"Usage de" being two words was tripping it
2023-10-03 18:49:16 +02:00
Louis Gesbert
2c6e6bf0b5 Disambiguate constructors and fields across modules 2023-10-03 18:49:00 +02:00
Louis Gesbert
8194abaf93 Operator mismatch fix
wow this remained unspotted for some time...
2023-10-03 18:44:12 +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
a79acd1fa8 Reformat 2023-09-27 13:19:04 +02:00
Louis Gesbert
ce17d8e563 Fix plugins compilation 2023-09-27 13:18:28 +02:00
Louis Gesbert
ade51234e8 Discard catala option --build-dir that is not useful in the end 2023-09-27 13:18:28 +02:00
Louis Gesbert
50fad76df3 Clerk: copy files to _build and run catala there
this is more consistent, avoids empty stamp files and should make things simpler
overall.

The slightly tricky `-C` option is added to Catala so that it can be run from
_build while paths to source and destination files are still specified relative
to CWD (Ninja doesn't provide string manipulation, so otherwise we would have to
explicit both the `_build/dir/` and `dir/` versions of each path).
2023-09-27 13:18:28 +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
cc7066e9a8 Clerk: better handling of transitive dependencies
We need a concrete intermediate target for e.g. transitive uses of `> Include`
for Ninja to correctly handle them.

Of course we could also unroll all transitive dependencies, but meh.

Note also that now tests now just generate the outputs but facilities for
diffing and resetting are temporarily absent.
2023-09-27 13:14:40 +02:00
Louis Gesbert
dbe0990163 Rework module includes CLI in Catala
Rather than require all files to be listed on the command-line (and having to
check consistency with `> Using` directives), the main catala CLI is now a bit
more clever.

⇒ There is a new assumption that a module name definition must match the file
name (up to case and extension) — with appropriate error handling to enforce it.

In exchange, `> Using` directives are now used to more transparently lookup the
appropriate `.catala_*` interfaces and the compiled artifacts for the used modules (handling transitive dependencies), with just standard `-I` flags for when they need to be looked up in different places.
2023-09-27 13:14:40 +02:00
Louis Gesbert
4bce4e6322 Reformat 2023-09-27 13:14:38 +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
494be673a8 Rehaul the Clerk build system to fully handle modules and linking 2023-09-27 13:08:15 +02:00
Louis Gesbert
cf8f365cf7 Extract Catala version from dune
(avoids multiple, possibly inconsistent, definitions ; also syncs up Clerk
versions with Catala)
2023-09-27 13:08:15 +02:00
Louis Gesbert
94ec864890 Scan file tree: proceed in sequence 2023-09-27 13:08:15 +02:00
Louis Gesbert
bf048f0a74 Add a lightweight lexer for dependency extraction in Clerk
The base is there but not fully used yet in Clerk
2023-09-27 13:08:15 +02:00
Louis Gesbert
9aed2c7479 support for parsing Module directives 2023-09-27 13:08:11 +02:00
Denis Merigoux
ec18ac10bb
Fix missing implem 2023-09-22 18:06:44 +02:00
Denis Merigoux
1f4805caad
Print interpreter error messages with localized expression printer 2023-09-22 18:06:43 +02:00
Denis Merigoux
9cecf5587a
Register surface syntax languge in program troughout the compilation chain 2023-09-22 18:05:26 +02:00