Commit Graph

49 Commits

Author SHA1 Message Date
Louis Gesbert
5e9c3d630e
Same treatment for typ and marked_typ 2022-08-29 11:29:24 +02:00
Louis Gesbert
be58610061
Rename marked_expr -> expr, expr -> naked_expr throughout
Since the marked kind is used throughout, this should be more clear
2022-08-29 11:29:23 +02:00
Louis Gesbert
8f7ba5ccaf
Rename marked_gexpr -> gexpr, gexpr -> naked_gexpr
Since the marked kind is used throughout, this should be more clear
2022-08-29 11:29:23 +02:00
Louis Gesbert
4caf828e48 Additional cleanup/fixes on the compiler refactoring
following review ^^
2022-08-23 00:13:02 +02:00
Louis Gesbert
4bb49c14f1 Simplify some type aliases 2022-08-22 19:28:27 +02:00
Louis Gesbert
06dbab74d2 reformat 2022-08-22 19:28:27 +02:00
Louis Gesbert
2b6ee8dd4b Leverage the shared AST: big cleanup (part I) 2022-08-22 19:28:21 +02:00
Louis Gesbert
988e5eff1c Split the shared AST into a separate lib 2022-08-22 19:16:28 +02:00
Louis Gesbert
0b0e774d1c More factorisation, in particular for variables 2022-08-12 17:18:06 +02:00
Louis Gesbert
ebf97a0995 Pass-specific literals 2022-08-12 16:55:32 +02:00
Louis Gesbert
b5579cde3d Generalise the expressions between dcalc and lcalc
The huge benefit of this approach is that almost no changes are needed and we get compatible types between dcalc and lcalc, allowing to deduplicate a few functions.

It might not be the best in the long run: there are still benefits in factorising small parts of the AST as suggested in #157, and this forces a central AST definition that makes the nanopass-like approach a bit less legible.

Still, I think it's a step in the right direction and it doesn't really lock us in keeping to use the big GADT (as the minimal cascade of changes show).
2022-08-12 16:55:30 +02:00
Emile Rolley
0c180e12f9 refactor(runtimes): add runtime_ocaml and runtime_jsoo in the catala package 2022-07-22 16:52:56 +02:00
Denis Merigoux
b7c468bd1e
Fix faulty unboxing 2022-07-22 16:18:55 +02:00
Denis Merigoux
522deb50c2
Factorizing Dcalc.program 2022-07-22 15:49:57 +02:00
Louis Gesbert
83de1a229b Mark the optimization passes as untyped
It's not expected to stay that way forever, but some additional effort will be required for them to preserve (or restore) types; until then, be safe and don't forward possibly incorrect information.
2022-07-13 12:17:43 +02:00
Louis Gesbert
7485c7f2ce Reformat 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
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
Denis Merigoux
8ce81fedaa
Start to refactor Lcalc AST (WIP) [skip ci] 2022-04-15 12:16:44 +02:00
Denis Merigoux
8be3d1cfc9
Made more functions generic in Dcalc.Ast 2022-04-12 17:54:00 +02:00
Denis Merigoux
c7c774a1a1
Closure conversion: case of EAbs implemented 2022-03-31 12:19:31 +02:00
Denis Merigoux
a660987df0
Starting to implement closure conversion [skip ci] 2022-03-21 17:26:23 +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
Alain
7e1057c541 review of lcalc 2022-02-18 15:47:54 +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
a06dfbfaa5
Assets and formatting 2022-02-04 15:29:31 +01:00
Alain
6ad948ed76 more cleanup in lcalc-ast 2022-02-04 15:13:28 +01:00
Alain
6da5cc518b cleanup dcalc-ast.ml 2022-02-04 12:33:26 +01:00
Alain
f8343d1d0c cleanup lcalc-ast.ml 2022-02-04 12:28:03 +01:00
Alain
d7c422d33c clarify make_matchopt + lcalc's ast ocamlformat 2022-02-02 12:23:52 +01:00
Alain
fcf6fecf71 implementation of a few cases in the translation without exceptions 2022-01-28 11:07:29 +01:00
Alain
1bfb891aa1 printing dcalc and lcalc ast 2022-01-25 13:55:17 +01:00
Alain
df545e5761 add translate_binder
refactor make_bindopt
refactor make_matchopt
added make_bindmopt
remove _{i}_ printing in to_ocaml
add correct printing of handle_default_opt
add two-step translation
correct context for new variables
2021-12-07 18:57:28 +01:00
Alain
177a2149ac handle_opt 2021-12-07 16:03:15 +01:00
Alain
76f5e6115c changing signature -- cont 2021-11-30 18:05:30 +01:00
Denis Merigoux
536dde9834
Formatting + CI + etc 2021-11-30 16:27:47 +01:00
Alain
8d580f1db6 fix: removed ESome and ENone constructions. 2021-11-29 17:53:07 +01:00
Alain
22af2a9335 refactored transformation to remove matchopt construction 2021-11-29 17:40:30 +01:00
Alain
c2db3a40c6 ref: use of built-in match instead of matchopt (wip) 2021-11-26 17:10:31 +01:00
Alain
fcdaa21d54 add utilities that replace to deal with options 2021-11-25 17:27:06 +01:00
Denis Merigoux
fb281a0d99
Formatting 2021-11-24 15:22:29 +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
6fdd739f54 saving my work somewhere 2021-11-22 15:55:21 +01:00
Denis Merigoux
eb9c75f394
Making progress into translation 2021-06-23 17:47:34 +02:00
Denis Merigoux
bbd50747d9
Big renaming and dir reorg 2021-06-21 11:39:06 +02:00