Commit Graph

1366 Commits

Author SHA1 Message Date
Denis Merigoux
ca8e4989ea
Type Scalc flow to avoid unresolved typing
With the new EAppOp node, the typing of operator application has changed and this causes some problems
with the example in test_scope/good/nothing.catala_en when retyping the LCalc to go to Scalc. This
commit changes the weird thing that for generating Scalc, the "typed" parameter was set to "untyped".
2024-01-17 13:08:20 +01:00
Denis Merigoux
a1ab58478c
Remove useless field 2024-01-17 11:29:39 +01:00
Denis Merigoux
349da741d4
Merge branch 'master' into c_backend 2024-01-16 16:23:35 +01:00
Louis Gesbert
8ed45c2762
Fixes missing minus sign printing for small negative amounts of money (#560) 2024-01-16 12:21:29 +01:00
Denis Merigoux
15c7691c09
Fixes #555 2024-01-16 11:40:10 +01:00
Denis Merigoux
b616e60c79
Fixes #558 2024-01-16 11:29:45 +01:00
Denis Merigoux
9f03b6b931
Merge branch 'master' into c_backend
Some tests still failing...
2024-01-15 17:19:17 +01:00
Louis Gesbert
12f208b3fc Adding tuples: fixes following review 2024-01-08 12:16:07 +01:00
Denis Merigoux
919dd2b812 Monomorphization properly done 2023-12-20 17:45:39 +01:00
Denis Merigoux
dcd883e53c
Uppercase constructors 2023-12-19 17:40:38 +01:00
Denis Merigoux
a9764d607e
Merge branch 'master' into c_backend 2023-12-19 17:39:02 +01:00
Louis Gesbert
d3e7c565a9 Closure conversion: use multiple let-in 2023-12-19 17:30:32 +01:00
Louis Gesbert
5384394a72 Fix typing upon detuplification 2023-12-19 17:30:32 +01:00
Louis Gesbert
a2efc94fd2 Register the option type in ctx when used in lcalc 2023-12-19 17:30:28 +01:00
Louis Gesbert
a1c1a7756f Update invariant tests outputs 2023-12-19 17:27:44 +01:00
Louis Gesbert
2823795f9f AST change: more specific application
As part of making tuples first-class citizens, expliciting the arity upon
function application was needed (so that a function of two args can
transparently -- in the surface language -- be applied to either two arguments
or a pair).

It was decided to actually explicit the whole type of arguments because the cost
is the same, and this is consistent with lambda definitions.

A related change done here is the replacement of the `EOp` node for operators by
an "operator application" `EAppOp` node, enforcing a pervasive invariant that
operators are always directly applied. This makes matches terser, and highlights
the fact that the treatment of operator application is almost always different
from function application in practice.
2023-12-19 17:27:40 +01:00
Denis Merigoux
af16be501a
Remove useless optimizations caught just after 2023-12-19 17:26:36 +01:00
Denis Merigoux
9d9a2c4496
Start to implement proper monomorphization 2023-12-19 17:26:17 +01:00
Louis Gesbert
94ebc1b65e Allow deconstruction of tuples using let in 2023-12-19 17:25:44 +01:00
Louis Gesbert
df3ab64fe9 Add tuples to the surface language
No helpers to destruct them at the moment
2023-12-19 17:25:44 +01:00
Louis Gesbert
fb51f58261 Optimise away trivially-true errors-on-empty 2023-12-19 16:10:11 +01:00
Louis Gesbert
ea4e191f27 Add optimisation to skip variable aliasings
This particularly of effect to the code introduced by closure conversion.
2023-12-19 16:07:22 +01:00
Louis Gesbert
7233ec403a Printer: add parens after constructors 2023-12-19 16:07:22 +01:00
Louis Gesbert
ad0afa2f64 Small interpreter optimisation
This is unholy, but we're manually bringing a typing proof so it may be
acceptable...
2023-12-19 16:07:22 +01:00
Louis Gesbert
e123d7eb95 Change type syntax of collection into list of 2023-12-19 15:26:44 +01:00
Louis Gesbert
3779a249db Unify all CLI arguments to use - rather than _
it's more common on UNIXes and the mix was unpleasant.
2023-12-19 15:25:37 +01:00
Denis Merigoux
85bbb7be1c
Add monomorphizing option 2023-12-19 15:01:06 +01:00
Denis Merigoux
9358ad945e
Better type translation in closure conversion 2023-12-19 14:31:57 +01:00
Denis Merigoux
e6a35f31b6
Fixes #551 2023-12-19 13:39:24 +01:00
Denis Merigoux
366c351930
Correctly compiles let bindings in expressions 2023-12-19 12:03:23 +01:00
Denis Merigoux
0323e71edb
Default types should be eliminated in compile_with_exceptions 2023-12-18 15:23:08 +01:00
Denis Merigoux
4eead4850b
There are no more defaults in type after compile_with_exceptions... 2023-12-18 15:14:28 +01:00
Denis Merigoux
91f8451899
Better beta-reduction 2023-12-18 14:49:43 +01:00
Denis Merigoux
35f829cd65
Fix default optimisation 2023-12-18 14:42:58 +01:00
Denis Merigoux
1f91c16e43
Fix little bug 2023-12-13 16:40:22 +01:00
Denis Merigoux
5c49581207
Compiling simple program correctly to C 2023-12-13 11:07:08 +01:00
Denis Merigoux
827fcef469
More progress but enums also require no struct literals 2023-12-12 18:21:20 +01:00
Denis Merigoux
adfb9297d3
Progress on compiling 2023-12-12 16:25:02 +01:00
Denis Merigoux
d88f67bb2c
Progress 2023-12-12 16:08:40 +01:00
Denis Merigoux
7e221b29eb
Gets C89 struct initialization right 2023-12-11 17:28:32 +01:00
Denis Merigoux
37ab4187bd
Almost there with structs 2023-12-11 17:08:32 +01:00
Denis Merigoux
aca1d0e712
Fields in AST nodes 2023-12-11 15:59:47 +01:00
Denis Merigoux
3711026a4f
Beginning to compile 2023-12-11 14:47:09 +01:00
Denis Merigoux
5b7470fd0d
Compile HandleDefaultOpt specially 2023-12-11 14:34:31 +01:00
Denis Merigoux
f072694e50
Trying to progress 2023-12-11 13:56:13 +01:00
Denis Merigoux
79a261bb47
Restore CI 2023-12-11 11:44:25 +01:00
Denis Merigoux
c61bdbc5d7
Setting up special compilation 2023-12-11 11:31:51 +01:00
Denis Merigoux
4e8d2ef219
Beginning to compile specially HandleDefaultOp, Map, Fold, etc. for C 2023-12-11 11:31:51 +01:00
Denis Merigoux
4f7b678cd7
Making progress and fixing bugs 2023-12-11 11:31:51 +01:00
Denis Merigoux
192e50540b
Correctly compile function pointer types 2023-12-11 11:31:51 +01:00