Denis Merigoux
f9a6644da3
Cleanliness and aesthetics
2023-04-18 15:45:30 +02:00
Denis Merigoux
0ec75ad589
Merge branch 'master' into adelaett-withoutexceptionsfix
2023-04-18 14:37:02 +02:00
Denis Merigoux
0b0451862e
Correct temp variable names
2023-04-18 14:29:22 +02:00
Louis Gesbert
bd870b0c28
Add experimental lazy interpreter as a plugin ( #453 )
2023-04-18 14:08:03 +02:00
Denis Merigoux
732e058712
Fix typos
2023-04-18 11:42:33 +02:00
Denis Merigoux
0266252854
Refactoring for cleaner exception graph building
2023-04-18 11:06:58 +02:00
Denis Merigoux
57da622567
Refactoring changes after @altgr's suggestions
2023-04-18 10:31:44 +02:00
Denis Merigoux
c5ba3e72fe
Restore CI
2023-04-18 09:59:24 +02:00
Denis Merigoux
39f1704d76
Last fixes
2023-04-18 09:59:24 +02:00
Denis Merigoux
ecccb5fb91
Last changes
2023-04-18 09:59:24 +02:00
Denis Merigoux
6479c3c10b
Print exception tree
2023-04-18 09:59:24 +02:00
Denis Merigoux
2afb6fc20c
I/O plumbing necessary for this feature, missing main implem
2023-04-18 09:59:24 +02:00
adelaett
5e46253140
removed one remaning debuging print, and updating all the tests
2023-04-14 17:59:08 +02:00
adelaett
e712c39efb
fix python printing of handle_default
2023-04-14 17:32:09 +02:00
adelaett
b642bdbc54
update optimizations
2023-04-14 17:16:01 +02:00
Louis Gesbert
b4a68fa392
Add experimental lazy interpreter as a plugin
...
To try it (without installing Catala):
```shell-session
$ make plugins
$ export CATALA_PLUGINS=_build/default/compiler/plugins
$ dune exec -- catala lazy examples/aides_logement/tests/tests_calcul_apl_locatif.catala_fr -s Exemple2
```
Keep in mind that this is a work-in-progress prototype :)
2023-04-14 16:56:57 +02:00
adelaett
adf14056fd
backtrace is now determined by the option.debug flag.
2023-04-14 16:38:39 +02:00
adelaett
e14267b0d7
fixing printing
2023-04-14 15:03:26 +02:00
adelaett
cffcdd7cf9
move monad_* to lcalc/Ast.ml
2023-04-14 14:36:28 +02:00
adelaett
02eeb4ad11
Include Bindlib_ext to Expr.Box
2023-04-14 14:18:28 +02:00
adelaett
ebf72213a7
deadcode
2023-04-14 14:12:36 +02:00
adelaett
ddeaa67ff7
Expr.eid -> Expr.fun_id
2023-04-14 14:07:51 +02:00
adelaett
484ae44298
disable detailled printing of enum and struct
2023-04-14 13:59:29 +02:00
adelaett
920bd29835
documentation and deadcode elim
2023-04-14 13:59:06 +02:00
adelaett
f21cb1ff69
adding comment
2023-04-14 12:18:28 +02:00
adelaett
6b6272b0f2
adding an nicer error message
2023-04-14 12:16:09 +02:00
adelaett
123ae9e4c1
rename functions to make the code more readable
2023-04-14 12:15:16 +02:00
adelaett
0c357d2972
adding typing information for monad_* functions
2023-04-14 12:13:33 +02:00
adelaett
167ec9189f
adding a todo related to handle_default and handle_default_opt for
...
the closure conversion.
2023-04-14 12:02:03 +02:00
adelaett
abc30e1612
handling invariants checking differently in the main driver
2023-04-14 12:01:16 +02:00
adelaett
cfc1d86e96
Revert "incorrect simplification"
...
This reverts commit 3233ff108f
.
2023-04-14 11:51:02 +02:00
adelaett
3233ff108f
incorrect simplification
2023-04-14 11:48:19 +02:00
adelaett
622feec9a5
change Invariants choice to --check_invariants flag
2023-04-14 11:32:49 +02:00
adelaett
2ea67de397
typo
2023-04-14 11:21:52 +02:00
adelaett
a9809b69a9
Merge branch 'master' into adelaett-withoutexceptionsfix
2023-04-14 11:19:58 +02:00
adelaett
5833608179
deadcode elim
2023-04-14 10:56:15 +02:00
adelaett
a45ae1869a
Fix #449 by removing premature optimizations on a smart constructor.
2023-04-14 10:50:21 +02:00
adelaett
a53bc27d23
documentation
2023-04-14 10:48:31 +02:00
Louis Gesbert
feeee4016e
Add support for dcalc plugins
...
previously only lcalc and scalc where available
2023-04-14 10:42:26 +02:00
adelaett
f8f6e56cca
fixing the issue of not merging inputs.
2023-04-14 09:22:36 +02:00
Louis Gesbert
e19e4af12d
Vastly improve the printer
...
* fix lots of Format boxes
* add parens based on precedence in the printer
* fix interaction of Format and the colored line debug tags
2023-04-13 18:15:22 +02:00
adelaett
cc66023e51
Thunking justifications and conclusion in avoid_translation pass
2023-04-12 10:58:21 +02:00
adelaett
83553d5950
indicate what interpreter is launched in debug mode.
2023-04-11 16:15:24 +02:00
adelaett
1a46cd8914
initialize inputs argument with default ENone value
2023-04-11 16:14:52 +02:00
adelaett
49e9846386
fix a bug in the translation
2023-04-11 16:14:25 +02:00
adelaett
0cfc446455
implementing the behavior of handle_exceptions_opt for the lcalc interpretor
2023-04-11 14:09:57 +02:00
adelaett
3e35d4b826
Merge branch 'master' into adelaett-withoutexceptionsfix
2023-04-11 11:49:22 +02:00
adelaett
6af7456b98
typo
2023-04-07 16:32:43 +02:00
adelaett
37b2cdf1aa
printing bindm as let*
2023-04-07 16:21:42 +02:00
adelaett
0e8eed7ee1
program equality function
2023-04-07 12:10:08 +02:00
adelaett
300d3b561d
fix too-many-spaces
2023-04-07 12:09:38 +02:00
adelaett
6c7ac061d4
fix identation and use new formatting functions as default
2023-04-07 11:57:14 +02:00
adelaett
618ff0518d
move printing of program & scope to the Print module
2023-04-07 11:26:10 +02:00
adelaett
12d85570e8
fix printing boxes & merge issues
2023-04-07 10:51:21 +02:00
adelaett
9b63743c2f
documentation
2023-04-07 10:49:48 +02:00
Denis Merigoux
77d6a97ddc
Formatting
2023-04-06 16:35:28 +02:00
alain
ec40de83fc
Merge branch 'master' into adelaett-withoutexceptionsfix
2023-04-06 13:57:22 +02:00
adelaett
73423a3cb6
typo
2023-04-06 13:50:58 +02:00
adelaett
65d9ac759a
review printer
2023-04-06 13:50:48 +02:00
adelaett
0906ba025b
reviewed operator.ml
2023-04-06 13:50:34 +02:00
adelaett
5a3a6a9dc1
remove unused json ppx
2023-04-06 13:50:22 +02:00
adelaett
7ebfb2e66a
typo
2023-04-06 13:42:40 +02:00
alain
f16842b71a
add a todo
2023-04-06 13:18:33 +02:00
adelaett
7b0f1b238c
add documentation for interpret_lcalc
2023-04-06 13:09:49 +02:00
adelaett
75e496c62d
correct types
2023-04-05 16:35:12 +02:00
adelaett
72f6ac9f58
append lcalc to driver
2023-04-05 15:42:26 +02:00
adelaett
256c0625ff
forward -> propagate
2023-04-05 14:57:02 +02:00
Louis Gesbert
0098f00512
Yet some more small improvements to the AST encoding
2023-04-05 10:32:58 +02:00
Louis Gesbert
0c1cd481e1
Interpreter on dcalc + lcalc (the simple way)
...
I made some changes in the meantime, and had to factorise e.g. the handling of
the `EEmptyError` case, but this is the simple approach type-wise of making the
function type for `∀ 'a. 'a —> 'a` (with `assert false` match cases), then
restricting its type do `dcalc` or `lcalc` in the `.mli`.
2023-04-05 10:32:58 +02:00
Louis Gesbert
79ff776d2e
Multi-pass interperter: typing (but useless) version
2023-04-05 10:32:58 +02:00
adelaett
503cd6b1e5
implementation of the behavior
2023-04-05 10:32:52 +02:00
adelaett
06147ac5b6
typing working in the file, but does not accept
...
Lcalc for some reason
2023-04-05 10:32:52 +02:00
adelaett
68e0f0a0ee
changing position of the interpreter
2023-04-05 10:32:52 +02:00
adelaett
82992e9858
documentation
2023-04-04 17:02:26 +02:00
adelaett
066388ddfd
fix of_lcalc special handling of handle_opt variables
2023-04-04 15:58:05 +02:00
adelaett
60f8c229d5
fix to_ocaml new handledefault and handledefault opt operator
2023-04-04 15:57:33 +02:00
adelaett
06f2e56c74
fix closure conversion non-existent variable
2023-04-04 15:57:11 +02:00
adelaett
8ef3db005f
clean deadcode
2023-04-04 15:56:49 +02:00
adelaett
61bdd751e4
corrected program equality
2023-04-04 15:18:08 +02:00
adelaett
b6cf552913
lcalc optimization documentation
2023-04-04 15:17:59 +02:00
adelaett
948af85abd
simplification of the driver
2023-04-04 15:17:43 +02:00
Denis Merigoux
ad02a0959d
Merge branch 'master' into aides_logement_outre_mer
2023-04-03 14:12:10 +02:00
Denis Merigoux
38b0041bb8
Add common linting passes to Catala ( #438 )
2023-04-03 14:01:02 +02:00
Denis Merigoux
d147238088
Apply suggestions by @altgr
2023-04-03 13:42:14 +02:00
adelaett
685785eaa3
adding assert_closed function
2023-04-03 11:20:19 +02:00
adelaett
f897226ffb
bindlib extension documentation
2023-04-03 10:57:52 +02:00
adelaett
84548769b4
renable optimization since the behavior of ite is now different
2023-04-03 10:56:44 +02:00
adelaett
cc1c018818
trace flag when needed
2023-04-03 10:56:13 +02:00
adelaett
2a50a06b36
invariant mli
2023-04-03 10:38:33 +02:00
Denis Merigoux
e80143b3ca
Last linting pass and update tests
2023-03-31 17:56:45 +02:00
Denis Merigoux
b3949ae15c
Update assets
2023-03-31 16:55:51 +02:00
Denis Merigoux
6d71d52a2e
Update tests and create disable_warnings option
2023-03-31 16:43:03 +02:00
adelaett
380a3a0c92
structural invariants
2023-03-31 16:03:51 +02:00
adelaett
e9ead93f3f
fix typing errors
2023-03-31 16:01:05 +02:00
adelaett
573df8416f
Merge branch 'master' into adelaett-withoutexceptionsfix
2023-03-31 15:52:06 +02:00
adelaett
272dc9e8b3
optimization reorg
2023-03-31 15:37:18 +02:00
Denis Merigoux
0057afc623
Fixing things after @JusBanuls' review pass on the code!
2023-03-31 15:34:50 +02:00
adelaett
beeecce091
correcting filter definition
2023-03-31 15:31:43 +02:00
Denis Merigoux
3d86a12261
Update error messages
2023-03-31 14:01:04 +02:00
Denis Merigoux
a7ee7074f9
Improve linting
2023-03-31 13:50:02 +02:00
Denis Merigoux
565aa23b8f
Implemented some lints
2023-03-31 11:47:44 +02:00
adelaett
69ac8ca929
implementation of fold, reduce, map & filter in without exceptions
...
Work in progress: not working for filter & map
2023-03-31 11:24:43 +02:00
Louis Gesbert
038861a52c
Generic mapping function across different ASTs
...
Used in lcalc/compile_with_exceptions only at the moment
2023-03-30 18:57:51 +02:00
Louis Gesbert
1208744c6b
EmptyError is no longer a literal
...
it's much simpler to handle it as an AST node, as that makes the literal
identical across all AST passes.
2023-03-30 18:54:50 +02:00
Denis Merigoux
3c364aa1fa
Progress on linting, bugguy unused field detection
2023-03-30 18:52:29 +02:00
Denis Merigoux
9d64150a47
Add linting
2023-03-30 16:09:03 +02:00
Denis Merigoux
fff2b78e31
Deleting linting which will have its own pass
2023-03-30 15:56:39 +02:00
Louis Gesbert
817dcb09fc
Simplify variable translation functions
2023-03-30 15:41:03 +02:00
Louis Gesbert
4973c74410
Remove date rounding mode from Operator.translate
2023-03-30 15:33:00 +02:00
Louis Gesbert
a415355a39
Rework the AST Gadt to allow merging of different ASTs
...
The phantom polymorphic variant qualifying AST nodes is reversed:
- previously, we were explicitely restricting each AST node to the passes where it belonged using a closed type (e.g. `[< dcalc | lcalc]`)
- now, each node instead declares the "feature" it provides using an open type (e.g. `[> 'Exceptions ]`)
- then the AST for a specific pass limits the features it allows with a closed type
The result is that you can mix and match all features if you wish,
even if the result is not a valid AST for any given pass. More
interestingly, it's now easier to write a function that works on
different ASTs at once (it's the inferred default if you don't write a
type restriction).
The opportunity was also taken to simplify the encoding of the
operators, which don't need a second type parameter anymore.
2023-03-30 15:30:08 +02:00
Denis Merigoux
04629f58cd
Merge branch 'master' into aides_logement_outre_mer
2023-03-30 15:14:06 +02:00
adelaett
61830bc348
fixing runtime merge errors
2023-03-30 11:02:35 +02:00
adelaett
6dee3874cc
Merge branch 'master' into adelaett-withoutexceptionsfix
2023-03-30 10:50:32 +02:00
adelaett
7174480153
start of the translation of fold
2023-03-30 10:39:23 +02:00
adelaett
3e8aae99fe
typo in the traslation of lets
2023-03-30 10:39:07 +02:00
adelaett
729d634744
fixing translation of arrays
2023-03-30 10:38:54 +02:00
Aymeric Fromherz
b85a199daa
Add support for let .. in constructions in Z3 backend ( #434 )
2023-03-29 06:41:40 +09:00
adelaett
df740eed05
fixing with-exceptions
2023-03-28 10:07:01 +02:00
adelaett
37dcd96e41
correct scope debug formatting
2023-03-28 09:55:25 +02:00
adelaett
4fe23c894d
driver debugging code
2023-03-28 09:55:01 +02:00
adelaett
f3abc23c32
fixings tests (90% atm)
2023-03-28 09:54:44 +02:00
adelaett
c3d9ee299f
without exception: removing thunking
2023-03-28 09:54:04 +02:00
Denis Merigoux
44d8c32b9f
C backend for Catala : the closure conversion strikes back ( #364 )
2023-03-28 09:53:22 +02:00
adelaett
ba1c83f278
correct printing of option type
2023-03-28 09:52:40 +02:00
Denis Merigoux
e4c4339856
Small fixes
2023-03-28 09:38:47 +02:00
Aymeric Fromherz
5f04e0efaf
cleanup
2023-03-28 13:08:24 +09:00
Aymeric Fromherz
c711b0b1d7
cleanup
2023-03-28 13:00:07 +09:00
Aymeric Fromherz
082caae498
Add support for let_in in Z3 backend
2023-03-28 12:48:44 +09:00
adelaett
9806eb7e0f
format for program
2023-03-23 13:46:17 +01:00
adelaett
72ceafd67c
scopes does not return optional terms
2023-03-23 10:45:44 +01:00
Denis Merigoux
8b2f3319b8
Merge remote-tracking branch 'origin/master' into aides_logement_outre_mer
2023-03-21 17:57:38 +01:00
Louis Gesbert
69be2f6ed8
Fix literate output of dates
2023-03-21 16:59:34 +01:00
Denis Merigoux
3122dd7821
Update assets
2023-03-21 16:10:00 +01:00
adelaett
78c0842dc6
optimization tests
2023-03-21 14:31:45 +01:00
adelaett
256adcae4b
rename invariant
2023-03-21 14:31:21 +01:00
Denis Merigoux
48ef5b8f21
Fix warning and update assets
2023-03-21 14:00:49 +01:00
Denis Merigoux
578091f196
Restore check
2023-03-21 13:49:16 +01:00
Denis Merigoux
aa8ab3be3d
Merge branch 'master' into c_backend
2023-03-21 12:14:10 +01:00
Denis Merigoux
1a7982d225
Better printing
2023-03-21 11:24:19 +01:00
Denis Merigoux
7f705beb07
Merge branch 'master' into aides_logement_outre_mer
2023-03-17 17:52:10 +01:00
adelaett
d2da1c3e43
advancing
2023-03-17 17:24:51 +01:00
adelaett
7c39ad953b
fix iota optmi
2023-03-17 17:23:10 +01:00
adelaett
8c66fabe6a
fix mission operators in translate
2023-03-17 17:20:46 +01:00
adelaett
9a34ee95b1
equality program
2023-03-17 17:20:35 +01:00
adelaett
61ad00f277
unit test infrastructure for optimization
2023-03-17 17:19:50 +01:00
adelaett
850a1fdb56
more optimization on fold
2023-03-17 11:34:52 +01:00
Louis Gesbert
db09eb0c42
Add date rounding option in scope ( #397 )
2023-03-17 10:14:36 +01:00
Denis Merigoux
056e84792d
Printing warning for undefined variables
2023-03-17 09:25:14 +01:00
Denis Merigoux
4fcdd005e0
Merge branch 'master' into aides_logement_outre_mer
2023-03-17 09:18:27 +01:00
Raphaël Monat
d5cd5b206a
Show conflicting date rounding mode declarations when they happen
2023-03-16 18:51:01 +01:00
Raphaël Monat
8981b21edb
Add test for date rounding option conflict
2023-03-16 17:20:14 +01:00
Raphaël Monat
51ea9d8cff
Format code
2023-03-16 17:20:14 +01:00
Raphaël Monat
d3c27799de
Raise exception when more than one rounding mode option has been specified
2023-03-16 17:20:13 +01:00
Raphaël Monat
1e1e3b538e
Simplify format
2023-03-16 17:20:13 +01:00
Raphaël Monat
b013f4257d
Update parser error message
2023-03-16 17:20:13 +01:00
Raphaël Monat
887ec00d0e
Add explicit match
2023-03-16 17:20:13 +01:00
Raphaël Monat
64fa32392f
Update generated files
2023-03-16 17:20:09 +01:00
adelaett
4038ea02be
rainbox parenthesis
2023-03-16 17:15:08 +01:00
adelaett
82af9e8305
unfolding more bugs
2023-03-16 17:14:33 +01:00
Raphaël Monat
5fc1e8e5d5
Fix operator printing
2023-03-16 16:55:55 +01:00
Raphaël Monat
7021c41f93
Add date rounding option within scopes
2023-03-16 16:55:55 +01:00
adelaett
26551434f2
correct monadic bind & map implementation
2023-03-14 18:36:05 +01:00
adelaett
91ed8e1f5d
special handling of the option constructor as a polymorphic one with custom typing rules
2023-03-14 18:31:32 +01:00
adelaett
366a0d952b
introducing new operators for handleing defaults
2023-03-14 18:30:58 +01:00
Louis Gesbert
abc5a00c2f
Compile LaTeX code using minted without the Python venv
...
This is a hack, but not a dirty one: a new command `catala pygmentize` is added,
which is just a wrapper around `pygmentize` that calls it with the proper lexers
defined.
The point is that this needs no installation, just a stock `pygmentize`
installation and the `catala` binary.
2023-03-14 17:35:22 +01:00
Denis Merigoux
74df4ee988
Merge branch 'master' into aides_logement_outre_mer
2023-03-14 14:10:09 +01:00
Louis Gesbert
f1e44619e0
LaTeX literate output: handle pygments coloration from within Catala
...
This leverages the embedded lexer already used for HTML output, and uses the
LaTeX pygments backend to colorise code directly, without the need for `minted`.
2023-03-13 22:33:48 +01:00
adelaett
4d3b021eef
finished the implementation, but a few issues are missing
2023-03-13 16:51:06 +01:00
Louis Gesbert
5282aec400
LaTeX output: start refactor
2023-03-13 14:44:34 +01:00
Louis Gesbert
508992de33
Embed the Pygments Catala lexer
...
This enables the HTML output to work without a custom Pygments installation (or
the proper venv activated)
2023-03-13 14:41:24 +01:00
adelaett
b891114b72
tentative at a fully monadic encoding
2023-03-10 15:35:03 +01:00
adelaett
a8f0155c6e
Revert "toying"
...
This reverts commit 841b14aa0f
.
2023-03-10 15:34:29 +01:00
adelaett
21577ff1ba
introducing usefull term in the shared ast
2023-03-10 15:33:58 +01:00
adelaett
1580272d7f
more precise invariant
2023-03-10 15:32:42 +01:00
adelaett
ba74bbc52a
adding MapLabels and SetLabels to the standard Uid definitions.
2023-03-10 15:32:27 +01:00
Louis Gesbert
e1fe37ad09
Fix coloration in HTML output
2023-03-09 15:46:00 +01:00
Louis Gesbert
deb12d2c4a
Bump version to 0.8.0
...
Changelog:
---
A lot has been going on, with more than 530 patches and 70 PRs merged since
0.7.0 last summer. In summary:
- Quite a lot of syntax improvements and changes. Checkout the latest
[cheat-sheet](https://catalalang.github.io/catala/syntax.pdf ) for an overview
- Allow local `let ... equals ... in ...` definitions
- Better error messages and positions throughout
- Added the ability to directly call a scope and retrieve its outputs, like a
function
- Added disambiguation, allowing to access structure fields without specifying
the structure type each time
- Added automated resolution of operators, allowing e.g. to write just `+` in
place of all the type-specific operators `+.`, `+$`, `+@`, `+^`, etc.
- More consistent priority for operators. It is no longer allowed to write `a
and b or c` without parenthesis.
- Added and changed some operators (`date + duration` now allowed either way,
`int / int` now returns a decimal, added `duration / duration`)
- Added the ability to have variables and functions defined at
top-level (outside of any scope). See annex A of the tutorial for details.
- Added support for functions with multiple arguments
- Some big refactors in the compiler, allowing much better code sharing between
the different passes, and making it much easier to extend. Also added the
possibility to run the type-checker earlier, etc.
- Countless bug-fixes
- Improvements to our proof backend with Z3
- A tool to automatically synchronise with the upstream French law from
Legifrance
2023-03-08 18:07:53 +01:00
Louis Gesbert
6388a4b79f
Improved some error messages (cyclic defs, def positions)
2023-03-08 15:27:48 +01:00
Louis Gesbert
188a186735
Parser: make state rule syntax consistent with state definitions
...
Previously the `state` marker for rules was in a weird position:
```catala
rule foo under condition bar
consequence state st fulfilled
```
This patch unifies the syntax with definitions, now using instead:
```catala
rule foo state st
under condition bar
consequence fulfilled.
```
2023-03-08 15:17:58 +01:00
Louis Gesbert
42b8adb968
Add a duration / duration
overload
...
Interstingly enough, it was already implemented in the Python backend.
Required to implement *pro rata temporis*, which the US tax section 121 does
make use of.
Only allowed for durations expressed in days (as returned by `<date> - <date>`),
of course.
2023-03-08 15:17:58 +01:00
adelaett
841b14aa0f
toying
2023-03-06 18:26:46 +01:00
adelaett
6c0e04942f
corrected iota optimization
2023-03-06 16:00:41 +01:00
Denis Merigoux
bfc827296c
Merge branch 'master' into aides_logement_outre_mer
2023-03-06 14:09:51 +01:00
Denis Merigoux
1fe3987168
Formatting
2023-03-05 12:10:04 +01:00
Louis Gesbert
5398b1037f
Fix ill-funded order function on desugared vars
2023-03-03 19:22:17 +01:00
adelaett
78f121b44a
before any issues with mark on code_item
2023-03-03 11:39:55 +01:00
Louis Gesbert
97e0cfca6f
Improvements on function arguments refactoring
...
- simplify naming in the french law examples
- make messages yet more precise on function arguments mismatch
2023-03-02 19:11:21 +01:00
Louis Gesbert
3766e9db2c
Fix function argument naming consistency in the examples
2023-02-28 16:17:19 +01:00
Louis Gesbert
fc5910e093
Fix multi-argument scopedefs, improve error message positions
...
This adds a few positions to the parser, and tweaks some others, vastly
improving the reporting of some errors (inconsistent functions definitions, but
also exceptions cycles, etc.)
2023-02-28 15:53:50 +01:00
Louis Gesbert
2c97d5de14
Enforce consistency of function arguments naming
2023-02-28 15:53:50 +01:00
Louis Gesbert
8200457e43
Syntax change: require declaration of function argument names
2023-02-28 15:53:50 +01:00
Denis Merigoux
0667e3d40f
Merge branch 'master' into aides_logement_outre_mer
2023-02-28 15:01:31 +01:00
adelaett
73bd4b4064
finished to detect unpure subexpressions
2023-02-28 14:26:48 +01:00
adelaett
43b6595a09
Revert "not working fix for from_scopelang"
...
This reverts commit 1c837ec3b5
.
2023-02-28 09:32:25 +01:00
adelaett
1c837ec3b5
not working fix for from_scopelang
2023-02-28 09:32:10 +01:00
adelaett
178367efc0
adding invariant about App(EStructAccess)
2023-02-28 09:07:12 +01:00
adelaett
4cd3ec7cc3
Add an optimization pass to remove struct access of struct constructor
...
ie { e = x}.e -> x
2023-02-28 09:06:33 +01:00
adelaett
001a8205af
?
2023-02-28 08:39:30 +01:00
adelaett
631b6d77ff
Revert "Abandoning json conversion :("
...
This reverts commit 02780f5439
.
2023-02-28 08:37:50 +01:00
adelaett
02780f5439
Abandoning json conversion :(
2023-02-28 08:36:45 +01:00
adelaett
5fe09238c5
better error management when building with make_app
2023-02-28 08:36:45 +01:00
adelaett
2ae2ff7d50
adding a non-passing invariant
2023-02-28 08:36:34 +01:00
adelaett
75dc978fa9
remove logs from the no_partial_evaluation invariant
...
removed error_on_empty when functions
2023-02-27 11:20:59 +01:00
adelaett
b5f3621302
serialization wip
2023-02-27 11:20:59 +01:00
adelaett
9ec2b7785d
more work on invariants
2023-02-27 11:20:59 +01:00
adelaett
382150b513
new invariant option when launching the compiler
2023-02-27 11:20:59 +01:00
adelaett
6c3f0af9e0
invariant assertion checking
2023-02-27 11:20:59 +01:00
adelaett
173859d10e
invariant checking (untested)
2023-02-27 11:20:59 +01:00
adelaett
9319e94617
fix typo
2023-02-27 11:20:59 +01:00
adelaett
9a68563488
assert_internal & skeleton for the static pass
2023-02-27 11:20:59 +01:00
adelaett
8784ae6175
unpure detection in expressions
2023-02-27 11:20:59 +01:00
adelaett
214bc55aae
internal error message
2023-02-27 11:20:59 +01:00
adelaett
0262019d45
make app
2023-02-27 11:20:59 +01:00
adelaett
363ef39704
let case
2023-02-27 11:20:59 +01:00
adelaett
2a222f0aab
changed nix dependency from ocamlformat 24.1 to 21.0
2023-02-27 11:20:59 +01:00
adelaett
e765ee8a0c
requesting to have a typed tree
2023-02-27 11:20:59 +01:00
adelaett
44ce5a636b
fix tentative for functions applications
2023-02-27 11:20:59 +01:00
adelaett
5b33b39636
new helpers functions in lcalc's ast
2023-02-27 11:20:59 +01:00
Louis Gesbert
5bd140ae5f
Arrow List ( #404 )
2023-02-22 14:06:55 +01:00
adelaett
4f029db47b
explicitly don't accept multiple arguments from surface to desugared
2023-02-22 12:21:55 +01:00
adelaett
9f31715a47
style
2023-02-22 12:11:42 +01:00
adelaett
8553b9dd7e
Alternative printing of type TArrow
...
Changed the typing printing in the pretty printer to:
* () -> unit for empty lists
* a -> b for single elements lists
* (a, b, c, d) -> b for multiple elements lists
2023-02-22 11:52:22 +01:00
adelaett
bd0243359e
changed the invariant documentation of scopelang -> dcalc
...
Since functions inside catala can now have multiple arguments (while
not yet being user-definable) the invariant is now about partial
evaluation not being possible.
2023-02-22 11:42:48 +01:00
adelaett
576f21f69c
Added documentation for encoding constructors in the typing inference
2023-02-22 11:41:21 +01:00
adelaett
51b5ccb08e
change operator definition style to something more readable
2023-02-22 11:40:22 +01:00
adelaett
a4466fecc7
fixed some mixup in Format.fprintf arguments
2023-02-21 16:19:17 +01:00
adelaett
99d82bc33e
Fix toplevel type definition (if arg_types is [], then use a different way)
2023-02-21 14:17:24 +01:00
adelaett
b512dc6ec7
Fix List.combine internal error (create multiple TAny instead of only one)
2023-02-21 14:16:50 +01:00
adelaett
7036464df3
fix printing error (use utf8 insteed of ->)
2023-02-21 14:16:23 +01:00
adelaett
839a7ffd83
finished refactoring
2023-02-20 17:58:29 +01:00
adelaett
e519b7f146
until desugared
2023-02-20 17:21:44 +01:00
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
72cf477dd9
Toplevel definitions: fixes following review
...
Thanks @denismerigoux!
2023-02-15 12:40:15 +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
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