Commit Graph

324 Commits

Author SHA1 Message Date
Louis Gesbert
02fc255177 Typing scopes: bottom-up rather than top-down
it's better for error messages (and similar to how it was done before)
2022-07-11 17:42:34 +02:00
Louis Gesbert
18e86621d5 Port verification code to the AST changes 2022-07-11 17:42:34 +02:00
Louis Gesbert
5f882e35a2 dcalc ast: make the map function more polymorphic 2022-07-11 17:42:34 +02:00
Louis Gesbert
49efb5ddd7 Improve debugging, add backtraces (when recording is enabled) 2022-07-11 17:42:34 +02:00
Louis Gesbert
296a1de7dd Typing: add functions to type scopes without conversion to expr 2022-07-11 17:42:34 +02:00
Louis Gesbert
4eb5933ad0 Porting the interpreter to the marked AST 2022-07-11 17:42:30 +02:00
Louis Gesbert
6cc2e9a07b typing.ml: fix use of bindlib 2022-07-11 16:51:54 +02:00
Louis Gesbert
67179a793c Add type annotations on all AST nodes (first pass) 2022-07-11 16:51:54 +02:00
Louis Gesbert
513647cd32 AST simplification: remove redundant annotations
The AST structures track annotations (e.g., at the moment, source code
position information) in a lot of places. This patch tidies up a bit and
removes some duplication, ensuring a single level of annotation wrapping
at each AST recursion level.

This will be important when adding type information in these
annotations, because there will be consitency constraints to be ensured
and duplication is a likely source of mistakes.
2022-07-11 16:51:54 +02:00
Louis Gesbert
af0ac95682 Propagate renaming of Pos.mark* into module Marked
this patch is just a bunch of `sed` commands

```shell
cd compiler
sed -i 's/Pos.marked/Marked.pos/g' *.ml* **/*.ml*
sed -i 's/Pos.unmark/Marked.unmark/g' *.ml* **/*.ml*
sed -i 's/Pos\.get_position/Marked.get_mark/g' *.ml* **/*.ml*
sed -i 's/Pos\.same_pos_as/Marked.same_mark_as/g' *.ml* **/*.ml*
sed -i 's/Pos\.map_under_mark/Marked.map_under_mark/g' *.ml* **/*.ml*
sed -i 's/Pos\.mark/Marked.mark/g' *.ml* **/*.ml*
sed -i 's/Pos\.compare_marked/Marked.compare/g' *.ml* **/*.ml*
```
2022-07-11 16:51:54 +02:00
kescher
db9eec3b9f add support for duration multiplication
Signed-off-by: Jonathan Protzenko <protz@microsoft.com>
2022-05-31 11:17:38 -07:00
Louis Gesbert
f9fc1a8e8b Formatting: sync with master 2022-05-12 15:10:55 +02:00
Denis Merigoux
025382a85d
Restore debug info 2022-05-05 14:34:29 +02:00
Denis Merigoux
c7b84ca2d0
Merge pull request #244 from CatalaLang/c_backend
Bringing structure to the Lcalc AST
2022-05-05 14:22:26 +02:00
Denis Merigoux
78e8275d5e
Adds a decimal rounding operator 2022-04-29 21:18:15 +02:00
Denis Merigoux
6ea73a4291
Progress on refactoring [skip ci] 2022-04-26 12:07:39 +02:00
Denis Merigoux
c1c2953131
Fixing more errors [skip ci] 2022-04-25 10:19:04 +02:00
Denis Merigoux
88a522d120
Changed maps and folds for Dcalc 2022-04-15 12:16:22 +02:00
Denis Merigoux
8be3d1cfc9
Made more functions generic in Dcalc.Ast 2022-04-12 17:54:00 +02:00
Denis Merigoux
e7440e043c
Remove duplicated function 2022-04-12 17:07:00 +02:00
Denis Merigoux
33ff03a356
Map visitor for Dcalc 2022-04-12 11:51:33 +02:00
Denis Merigoux
b24dbc8360
Remove logging calls for vc generation 2022-04-12 11:14:39 +02:00
Denis Merigoux
48dda14dcd
Merge branch 'master' into c_backend 2022-04-12 10:53:46 +02:00
Denis Merigoux
a43f89a0f4
Parametrize Dcalc.scope_expr 2022-04-12 10:53:07 +02:00
Denis Merigoux
6f223d2519
Restore web build 2022-04-11 10:59:40 +02:00
Romain PRIMET
eafab30809 fix typo 2022-04-07 22:43:05 +02:00
Denis Merigoux
f2d1fab263
Refactoring to clean some Dcalc passes 2022-04-06 09:48:34 +02:00
Denis Merigoux
f6047a43ea
Added boxed constructors for Dcalc 2022-04-06 09:35:07 +02:00
Denis Merigoux
f6c8e7fbd9
Crediting author of moved code 2022-04-04 18:06:40 +02:00
Denis Merigoux
9d05dad3fb
Passing all tests! 2022-04-04 15:56:45 +02:00
Denis Merigoux
84144c0a56
Tests now passing except for a few position and printing issues [skip ci] 2022-04-04 12:25:00 +02:00
Denis Merigoux
2652b9c406
Continuing to adapt code to new binded representation [skip ci] 2022-04-02 14:51:11 +02:00
Denis Merigoux
8f39b65bb6
Started replacement of Ast by Binded_representation in Dcalc [skip-ci] 2022-04-02 12:29:43 +02:00
Denis Merigoux
cdac6de9fe
Implement the round money builtin 2022-03-17 12:30:14 +01:00
Aymeric Fromherz
9eec6a474c format 2022-03-08 20:43:55 +01:00
Aymeric Fromherz
9cbfc13288 Merge branch 'master' into afromher_dcalc 2022-03-08 20:41:35 +01:00
Aymeric Fromherz
3fb14264c2 Implement equal_ops in dcalc 2022-03-08 20:39:45 +01:00
Aymeric Fromherz
ac42bf65a7 Refactor to extract common equal_exprs_list and equal_typs_list 2022-03-08 20:31:22 +01:00
Aymeric Fromherz
5b345b4782 format 2022-03-08 20:23:45 +01:00
Aymeric Fromherz
2fa2f36c1d Optimize if_then_else when both branches are identical 2022-03-08 17:38:14 +01:00
Aymeric Fromherz
89d69c2316 Implement equality function on dcalc expressions 2022-03-08 17:35:08 +01:00
Denis Merigoux
5bd66142a6
Big reformatting
ocamlformat 0.19.0 -> 0.20.1
100 -> 80 columns per line
Reestablished @emilerolley's smart fun break
2022-03-08 15:03:14 +01:00
Denis Merigoux
c07bab1377
FIXME -> TODO 2022-03-08 14:55:48 +01:00
Louis Gesbert
12ec65601d Use format strings directly in debug/error/log functions
This avoids many intermediate calls to e.g. `Format.asprintf`; should result in
some cases in "more correct" use of `Format`¹, avoid the computation of unused
debug strings, and make the code more readable.

¹ for `Format` to work as expected, all intermediate calls need to go through
it. Some cases of formatting to an intermediate string then printing through Format
again are still present, but this makes the situation better.
2022-03-08 13:04:27 +01:00
Denis Merigoux
c65c38a2d5
Correct flag for enabling optimization 2022-02-24 16:46:02 +01:00
Alain
6fe75f3486 fv --> free_vars_set
free_vars --> free_vars_list
2022-02-21 11:51:01 +01:00
Alain
d7b9aa9492 fixing if-then-else bug 2022-02-18 16:11:22 +01:00
Alain
d512b27e2c fmt 2022-02-18 15:49:23 +01:00
Alain
19bf2d934f dcalc review 2022-02-18 15:31:52 +01:00
Denis Merigoux
48f064ccea
Adapt translation to new i/o invariants, bug discovered 2022-02-15 11:38:56 +01:00
Denis Merigoux
cab4e5c17e
Merge branch 'master' into alain_default-option 2022-02-15 10:20:53 +01:00
Denis Merigoux
b25f64c3ae
Improve printing 2022-02-14 17:01:34 +01:00
Denis Merigoux
69a7465339
Merge branch 'master' into alain_default-option 2022-02-14 12:09:11 +01:00
Denis Merigoux
9a718c6ced
Format comments 2022-02-14 12:07:35 +01:00
Alain
80fa3110eb
documentation + finished translating cut to hoist + copyright inside the compile_without_exceptions 2022-02-12 08:08:13 +01:00
Alain
77051cadba
fmt 2022-02-11 11:40:24 +01:00
Alain
cf28a58342
cut --> hoist
binded representation

few doc
2022-02-11 11:38:18 +01:00
Denis Merigoux
9bb858b79b
Added input/output/internal description in tutorial 2022-02-09 18:06:03 +01:00
Denis Merigoux
cb04ef3f9d
OnlyInput variables nore more thunked 2022-02-09 15:34:13 +01:00
Denis Merigoux
f3928dee9d
Better printing [skip ci] 2022-02-09 15:06:21 +01:00
Denis Merigoux
30061b8c86
Better encoding of inputs [skip ci] 2022-02-09 11:37:52 +01:00
Denis Merigoux
72274057cd
Better Dcalc printing 2022-02-06 18:25:37 +01:00
Denis Merigoux
97f8875a39
Merge branch 'master' into alain_default-option 2022-02-04 15:35:52 +01:00
Denis Merigoux
a06dfbfaa5
Assets and formatting 2022-02-04 15:29:31 +01:00
Denis Merigoux
11d4a34783
Better printing, tests, fix parser ommission 2022-02-04 15:10:47 +01:00
Alain
02187b4bc7 removed useless file 2022-02-04 14:53:47 +01:00
Alain
6da5cc518b cleanup dcalc-ast.ml 2022-02-04 12:33:26 +01:00
Alain
88eedbc000 ocamlformat 2022-02-04 09:27:10 +01:00
Alain
b777d3215b computing of free vars+ more debuging
finally found an error (List.fold_left instead of List.fold_right
2022-02-04 09:24:51 +01:00
Denis Merigoux
0d90dcea00
Better optimizations with values instead of literals 2022-02-02 10:30:39 +01:00
Denis Merigoux
effc2b24e4
Optimizations for defaults in Dcalc 2022-01-31 15:27:58 +01:00
Denis Merigoux
73ce2f142f
Fixed last bug around rule refactoring 2022-01-31 13:55:25 +01:00
Denis Merigoux
13b476d0a1
[skip ci] reorganized desugared to scope encoding, broke some invariants
WIP: fixed some bugs and provided documentations but one thing missing
2022-01-28 17:31:31 +01:00
Alain
1bfb891aa1 printing dcalc and lcalc ast 2022-01-25 13:55:17 +01:00
Denis Merigoux
d2977b48ce
Documentation pass 2022-01-19 10:54:16 +01:00
Denis Merigoux
0831f462ae
Correct signature 2022-01-12 16:28:03 +01:00
Denis Merigoux
16d8554384
Provide a function that removes all log calls 2022-01-12 16:25:46 +01:00
Denis Merigoux
d705334d9e
Merge branch 'master' into proof_platform 2022-01-11 15:43:33 +01:00
Denis Merigoux
f8dc1494f0
Autoformatting 2022-01-10 18:36:14 +01:00
Alain
5c5bc77c87 formatting (sorry, problem with the makefile) 2022-01-10 17:53:48 +01:00
Alain
baa435d2c5 optimization for not 2022-01-10 17:28:37 +01:00
Louis Gesbert
8d059b420e Fix console formatting with colors
closes #174
2022-01-10 15:56:55 +01:00
Denis Merigoux
ca7b009b02
Should compile 2022-01-10 14:35:51 +01:00
Denis Merigoux
ab194c76fd
Give function for retrieving variable types 2022-01-10 14:32:27 +01:00
Denis Merigoux
1fcd66ba78
Made pretty printing without logs for dcalc 2022-01-10 14:19:04 +01:00
Denis Merigoux
4082e5056e
More prettier things 2022-01-10 10:59:30 +01:00
Denis Merigoux
3a864b6160
Aesthetic improvements 2022-01-10 10:28:14 +01:00
Denis Merigoux
ad4218285d
Working partial evaluation for Dcalc using ugly but correct style 2022-01-09 19:16:34 +01:00
Denis Merigoux
743a1b74c9
Renamed and grouped modules cleanly 2022-01-08 18:37:04 +01:00
Aymeric Fromherz
8b6595426e Add Lt node and int literals 2022-01-07 18:54:15 +01:00
Aymeric Fromherz
ce80d1e9e9 Omit Log node from VC generation 2022-01-07 18:47:53 +01:00
Denis Merigoux
71a2f85d7c
Comments 2022-01-07 18:44:10 +01:00
Denis Merigoux
546107bfb0
Merge branch 'proof_platform' of github.com:CatalaLang/catala into proof_platform 2022-01-07 18:37:30 +01:00
Denis Merigoux
50224851f5
Port optimizations to Dcalc 2022-01-07 18:36:56 +01:00
Aymeric Fromherz
cc8e88ec4e Start supporting unary operators 2022-01-07 18:36:25 +01:00
Aymeric Fromherz
75b42423c6 Start encoding literals to Z3 2022-01-07 18:25:35 +01:00
Aymeric Fromherz
98b5518638 Add support for Z3 encoding of if_then_else 2022-01-07 18:23:46 +01:00
Aymeric Fromherz
f2bd803f0f Add support for Z3 encoding of binary operators application 2022-01-07 18:14:01 +01:00
Aymeric Fromherz
1105858bea Setting up the pipeline for encoding VCs to Z3 2022-01-07 17:50:45 +01:00
Aymeric Fromherz
6c67ed03bb Add z3 dependency to build system 2022-01-07 16:58:24 +01:00
Denis Merigoux
ee92ed2385
Added comments 2022-01-07 16:18:26 +01:00
Denis Merigoux
75ef1ef70f
Added proof of concept of verification condition generation 2022-01-07 12:04:31 +01:00
Denis Merigoux
3752328671
Code working but needs debugging [skip ci] 2022-01-05 10:42:46 +01:00
Alain
63ff6cfbb3 wip (compiling but can't compile catala program without internal errors)
instrumentation of Dcalc.expr to show internals representation
2021-12-16 19:16:57 +01:00
Alain
16b0dba9d0 Merge branch 'master' into feat/default-option 2021-12-14 10:27:11 +01:00
Denis Merigoux
9f0929b86d
Fix the final bug! 2021-12-10 17:55:24 +01:00
Denis Merigoux
f16ebf8b8b
Removed optimizations, just one weird bug missing [skip ci] 2021-12-10 17:23:14 +01:00
Denis Merigoux
e8a95db9ed
Trying to box everything but optimizations complaining 2021-12-10 16:54:51 +01:00
Denis Merigoux
00a998462a
Implementation OK, now on to debugging Bindlib [skip ci] 2021-12-10 16:30:36 +01:00
Denis Merigoux
50400c445d
Few progress 2021-12-09 23:29:49 +01:00
Denis Merigoux
c456a62cb3
Builds but with empty stubs [skip ci] 2021-12-09 22:59:39 +01:00
Denis Merigoux
3a21bec4b1
Scopelang to dcalc done [skip ci] 2021-12-09 18:42:36 +01:00
Denis Merigoux
fcf7c31279
Progress on Scopelang -> Dcalc [skip ci] 2021-12-09 13:54:10 +01:00
Denis Merigoux
d9f21e9e66
Progress 2021-12-09 11:58:42 +01:00
Denis Merigoux
6099d1e4ad
Beginning to bring more structure to Dcalc 2021-12-08 23:56:03 +01:00
Alain
0f5fde2c5a advancing 2021-11-22 15:55:21 +01:00
Alain
41a8961285 tentative, trying something else 2021-11-22 15:55:21 +01:00
Alain
a24a4ab6df starting to work on type inference 2021-11-22 15:55:21 +01:00
Denis Merigoux
2c0e8a7864
x10 performance on Catala compilation & interpretation
Cleaner rewriting of main let-binding chaining procedure from Scopelang to Dcalc
Removed costly unboxing in DCalc.Ast.make_let_in seemed to do the trick
2021-10-28 15:24:39 +02:00
Denis Merigoux
b56299f3d3
Switch ocamlformat to 0.19.0 2021-08-19 11:35:56 +02:00
EmileRolley
923a90b883 syntax(compiler): remove an @EmileRolley's note 2021-07-09 19:44:55 +02:00
EmileRolley
731513a003 refactor(compiler): factorize formatters inside prints modules 2021-07-08 16:36:53 +02:00
EmileRolley
6169d19b1e feat(compiler): add collection concatenation operator 2021-07-08 16:27:46 +02:00
Denis Merigoux
bbd50747d9
Big renaming and dir reorg 2021-06-21 11:39:06 +02:00