Commit Graph

2920 Commits

Author SHA1 Message Date
adelaett
f2bebe613b - [x] shared_ast 2023-02-20 15:57:42 +01:00
adelaett
d79b8463a6 - [ ] shared_ast 2023-02-20 15:57:42 +01:00
adelaett
391bf2527d make the change in the datatype 2023-02-20 15:57:42 +01:00
Louis Gesbert
8c40b1ddd0 Fix python output of toplevel defs
there is room for name clashes there though, maybe we should find a more
consistent renaming mechanism
2023-02-17 19:59:22 +01:00
Louis Gesbert
03645e6404 Rename Scalc from_lambda to from_lcalc for consistency 2023-02-17 19:49:56 +01:00
Denis Merigoux
fced0fff54
Add top-level definitions (#391) 2023-02-15 16:27:04 +01:00
Louis Gesbert
e5da498d15
Python backend: Date difference should always return duration in days (#396) 2023-02-15 16:17:19 +01:00
Louis Gesbert
72cf477dd9 Toplevel definitions: fixes following review
Thanks @denismerigoux!
2023-02-15 12:40:15 +01:00
Rohan Padhye
4c9bff1b74 Python backend: Date difference should always return duration in days 2023-02-14 13:48:19 -05:00
Louis Gesbert
d92ae2ccfd
Python backend: Use true division (#395) 2023-02-14 11:00:10 +01:00
Rohan Padhye
014e11720e Python backend: Use true division
Fixes a regression after the change in #368, which converted all
integer division to return a decimal. The code generation backend
was still using the integer division operand `//`, which is not
overloaded by class `Integer` in the catala runtime.
2023-02-13 16:31:24 -05:00
Louis Gesbert
c3af0b4097 Toplevel definitions: branch cleanup
- fix remaining warnings (mostly unused arguments)
- renamings throughout for consistency and clarity
2023-02-13 18:02:09 +01:00
Louis Gesbert
912e1500c4 Handle toplevel defs down to scalc 2023-02-13 11:44:32 +01:00
Louis Gesbert
6f1ac5837d Add syntax for calling multi-argument functions
* temporary and undocumented while waiting for discussion an approval
* previous patches already allowed definition (at toplevel) but there was no
syntax for calls
* no syntax for multi-args _local_ functions yet
2023-02-13 11:44:32 +01:00
Louis Gesbert
03f31b4923 Cheat-sheet: small fixes 2023-02-13 11:44:32 +01:00
Louis Gesbert
d66cd1e29c Toplevel defs: tests & fixes 2023-02-13 11:44:32 +01:00
Louis Gesbert
9b0c7583ec Add top-level definitions
Only handled until before scalc at the moment.
2023-02-13 11:43:49 +01:00
Louis Gesbert
98ebc36343 Add all missing parser error messages
... that's one less thing to do

Two notes:

- Updated the syntax errors in
  examples/NSW_community_gaming/tests/test_nsw_social_housie.catala_en ; those
  probably aren't expected though, but fixing them is outside my purpose here

- There is consensus on keeping the error messages in English; however, here,
  the error messages include hints on the syntax to use, which are only valid
  for users of the English syntax.
  * A possible solution would be to apply cppo on parser.messages, using the
    macros already defined in lexer_LANG.cppo.ml. However, we would then need to
    tweak (or duplicate!) the parser to use the messages for the correct language.
    Furthermore, updating and merging the file on parser updates would need
    special care.
  * Another, maybe easier solution would be manual processing, using a custom
    escape in the parser messages and rewriting that at runtime when printing
    the message. We would need to extract a runtime version of the macro
    definitions though.
2023-02-13 10:51:42 +01:00
Louis Gesbert
3f487a16ed WIP: handle toplevel definitions at the parser level 2023-02-13 10:51:42 +01:00
Louis Gesbert
0540cd31fe Allow ETuple, ETupleAccess on all ASTs
they used to be only allowed on lcalc
2023-02-13 10:51:42 +01:00
Denis Merigoux
7702949401
Better printing 2023-02-08 16:03:23 +01:00
Denis Merigoux
d7df6b3e80
Typing now takes into account [TAny] in structs/enums 2023-02-08 16:00:53 +01:00
Denis Merigoux
c78a004b53
Leave everything unresolved for now 2023-02-08 16:00:53 +01:00
Denis Merigoux
7d6abf36b2
Taking into account that closures can be input and output of scopes 2023-02-08 16:00:21 +01:00
Denis Merigoux
36a80b0ed3
Better type propagation 2023-02-08 16:00:21 +01:00
Denis Merigoux
6906fa48d1
Fix test for CI 2023-02-08 16:00:21 +01:00
Denis Merigoux
3577507ee9
Switch from closure-passing to environment-passing closure conversion 2023-02-08 16:00:21 +01:00
Denis Merigoux
e7d1fb84e9
Trying to retype closure conversion but fails [skip-ci] 2023-02-08 16:00:20 +01:00
Denis Merigoux
38d5ef9715
Small improvement 2023-02-08 15:59:51 +01:00
Denis Merigoux
4521d05839
Starting to implement hoisting 2023-02-08 15:59:51 +01:00
Denis Merigoux
47c6746982
One test passing 2023-02-08 15:59:51 +01:00
Denis Merigoux
83e9e83909
Progressing [skip ci]
Testing with dune exec catala -- Lcalc -s S tests/test_func/good/closure_conversion.catala_en  --avoid_exceptions -O --closure_conversion
2023-02-08 15:59:51 +01:00
Catala nix updated
775ebe088f update lock files 2023-01-30 00:20:18 +00:00
Catala nix updated
c4090dfec5 update lock files 2023-01-23 00:22:40 +00:00
Denis Merigoux
cee69acf3f
Actually merging #353 (#388) 2023-01-20 20:21:18 +01:00
Denis Merigoux
8405d243be
Fix compiler and tests 2023-01-20 14:10:18 -05:00
Denis Merigoux
7cffc53169
Merge branch 'master' into afromher_334 2023-01-20 14:05:38 -05:00
Denis Merigoux
fcca9e4c47
Correction after confirmation from regulatory body 2023-01-20 10:10:31 -05:00
Denis Merigoux
9ce7c7ef48
update nix documentation (#387) 2023-01-20 16:03:45 +01:00
adelaett
2012f352b2
update nix documentation 2023-01-19 11:31:45 -05:00
Louis Gesbert
839f2e19d5
Install Catala plugins (#386) 2023-01-17 15:41:03 +01:00
Louis Gesbert
467a338b6c Install Catala plugins
Fixes #378

- the plugins are compiled as libraries rather than with `executable`, so that
  dune is able to install them
- they get installed to `lib/catala/plugins/<plugin-name>/<plugin-name>.cmxs`
- the lookup for plugins is now recursive to cope with the plugin subdirectories
  in the point above
2023-01-17 14:38:09 +01:00
Louis Gesbert
7ae7c9ceaf Clerk: fix stale ninja files in /tmp not getting removed 2023-01-17 11:15:08 +01:00
Louis Gesbert
80dcc403ff
Add support for paths in the parser (#380) 2023-01-16 13:51:06 +01:00
Louis Gesbert
ca7f14e219 formatting fix 2023-01-16 12:10:33 +01:00
Louis Gesbert
19033669f5 Add support for paths in the parser
Using them will lead to "not supported yet" errors soon after, but it's a start
to get to handling separate modules.

The idea is that `foo` can now also be `Bar.foo`, `Bar.Baz.foo`, `foo.Struc.fld`
can be `foo.Bar.Baz.Struc.fld`, etc.
The next steps are to enable the lookups to handle this paths, and to provide
ways to load the external modules to feed these lookups.
2023-01-16 12:09:23 +01:00
Louis Gesbert
f835225a34 Tiny parser simplification
There is no need to keep separate rules for the different kinds of binops anymore.
2023-01-16 12:09:19 +01:00
Catala nix updated
4517cec1b0 update lock files 2023-01-16 01:27:21 +00:00
Denis Merigoux
f4c92530c6
Update aides_logement and fix bugs to produce an updated working simulator (#377) 2023-01-13 12:05:32 +01:00
Denis Merigoux
cd4f7db547
Removed useless file 2023-01-13 11:57:56 +01:00