Commit Graph

1580 Commits

Author SHA1 Message Date
Louis Gesbert
cee8e57d02 More precise positions for operators throughout 2024-04-30 16:35:08 +02:00
Louis Gesbert
50d686f089 Pass exception positions to the HandleDefault operators
This puts runtime exception info on par with what we had in the interpreter, and
repairs the regression on the interpreter which no longer had them.
2024-04-29 16:09:38 +02:00
Louis Gesbert
959bcb9ccd Remove obsolete "except" type from the interpreter 2024-04-29 13:42:40 +02:00
Louis Gesbert
9d07015864 Unify runtime error handling
- Clearly distinguish Exceptions from Errors. The only catchable exception
  available in our AST is `EmptyError`, so the corresponding nodes are made less
  generic, and a node `FatalError` is added

- Runtime errors are defined as a specific type in the OCaml runtime, with a
  carrier exception and printing functions. These are used throughout, and
  consistently by the interpreter. They always carry a position, that can be
  converted to be printed with the fancy compiler location printer, or in a
  simpler way from the backends.

- All operators that might be subject to an error take a position as argument,
  in order to print an informative message without relying on backtraces from
  the backend
2024-04-26 18:31:26 +02:00
Louis Gesbert
791ae3229b Messages: adjust to terminal width 2024-04-26 15:40:55 +02:00
Louis Gesbert
97d007f1e7 Rename EmptyError to Empty
It's not an error! It happens in the normal control flow :)

This is to distinguish from the other runtime exceptions which are actually
fatal errors.
2024-04-25 14:39:15 +02:00
Louis Gesbert
090faf8c9f Fix statement ordering in scalc 2024-04-23 16:01:23 +02:00
Louis Gesbert
d72141653a Allow trace w/ avoid-exceptions, fix options in api_web
--trace and --avoid-exceptions is a warning, but we want to be able to test with
the combination (in particular, api_web as forcing --trace, so we couldn't
detect its issues with exceptions).
2024-04-23 16:01:23 +02:00
Louis Gesbert
623d2ef03d Add env variables to set flags -O, --avoid-exceptions, --trace
It makes it easier to batch-set them when testing a given repo with different
sets of options. Direct flags should still be preferred in general, of course.
2024-04-19 15:30:51 +02:00
Louis Gesbert
78200953f3
Improvements around external modules and error handling (#605) 2024-04-16 23:13:46 +02:00
Louis Gesbert
1de18f0e04 Preserve the capitalisation of module filenames
Module names must be capitalised (start with a capital letter), and the name of
the file on disk must match ; however, matching up to capitalisation is allowed,
i.e. the file on disk can start with a lowercase letter.

A mismatch between Clerk assuming generated module artifacts would match the
capitalised module name, and `catala depends` matching the names of files on
disk (because it would otherwise mean treating dependencies differently
depending on if they originate from modules or not) was causing "file not found"
errors later on in the compilation chain.

This patch enforces that the capitalisation of the original file name on
disk (which is always known) takes precedence in Clerk, matching the behaviour
of `catala depends` and fixing the issue. It's also actually a small
simplification in Clerk code.
2024-04-15 23:00:56 +02:00
Louis Gesbert
20288bcb26 Protect the interpreter against exceptions from custom code 2024-04-15 14:13:33 +02:00
Louis Gesbert
5d432d6bb9 OCaml runtime: register fallback exception printers
This was a pending TODO: now the Catala program compiled into OCaml should
return better messages and a little more information about uncaught exceptions.

Note that this also concerns, at the moment, compiled modules called from the
Catala interpreter: in this case, it's already better than nothing, but what we
need is proper interoperation between the runtime exceptions and the interpreter
handling (`EmptyError` should already be handled properly since it is critical
to the computation flow, but "error" exceptions are left uncaught and will kill
the interpreter).

This may be part of a bigger task on unifying the output of the runtime and
toplevel, which also concerns computation traces.

Note 2: All runtime exceptions don't have a position available, which is quite
unfortunate when your program hits an error. With `OCAMLRUNPARAM=b` and if
compiled with `-g` (which should normally be the case), you can get an OCaml
backtrace but that's not very friendly. Ideas for improvement:
- The runtime could force-enable backtrace recording (`Printexc.record_backtrace
  true`) to supersede the need for `OCAMLRUNPARAM`. We can also record our own
  handler to print the file position and/or backtrace in the way we see fit
- The printer of OCaml code in Catala could insert line directives so that the
  positions in the backtrace actually trace automatically back to the Catala
  code
- If we don't want to leverage any OCaml machinery in this way, the compiler
  should add position information to any operator that might fail (e.g.
  divisions, date comparisons, etc.).
Note that running in trace mode might already help pinpoint the location of the
error ?
2024-04-15 14:13:33 +02:00
Louis Gesbert
c8e529dd9f Fix: allow external modules to access the OCaml stdlib
This would deserve a further look into it, but for now it's impeding development
without providing any meaningful security.
2024-04-13 12:01:47 +02:00
Louis Gesbert
eded54d2b5 Support for direct tuple member access
As discussed in #549

NOTE: This implements only the direct tuple member access (syntax `foo.N` with N a
number)

- It seems more efficient to wait for the general pattern-matching rewrite to
  handle pattern-matching on tuples
- Until then we keep the (now obsolete) `let (x, y) = pair in x` syntax, to
  leave time for updates, but we won't be documenting it
2024-04-13 09:37:03 +02:00
Louis Gesbert
a61ae7979f
Support for structure updates
Closes #592

A new node is added in `desugared`, and translated into an exploded structure
literal during translation to `scopelang`. The main reason to put it there is
that it needs to be after disambiguation, since that is used to discover the
type of the structure that is being updated.
2024-04-12 17:17:48 +02:00
Louis Gesbert
b78cd9c29a
Improve message formatting throughout
Ensuring messages don't print overlong lines still requires some manual work:
- if they don't contain any `Format` directives (`%` or `@`), use `"%a"
  Format.pp_print_text` to turn word-wrapping on.
- otherwise replace spaces with `@ ` to mark possible cutting points, as soon
  that it's possible the line will get over 80 chars (most often, this means
  starting before the first `%a`)
2024-04-12 17:07:36 +02:00
Denis Merigoux
1e76366f51
Fix extra_pos/pos 2024-04-12 17:06:44 +02:00
Louis Gesbert
241f55a71a Fix formatting of messages
This preserves the existing
2024-04-10 19:26:23 +02:00
Louis Gesbert
def10e7f98 Message: further simplification 2024-04-10 19:26:23 +02:00
Louis Gesbert
9524e5d3f8 Message: remove the now obsolete interface 2024-04-10 19:26:23 +02:00
Louis Gesbert
98fc97a241 Rewriting message calls to use the new intf 2024-04-10 19:26:23 +02:00
Louis Gesbert
454667a47b Messages: add a more concise interface with optional args 2024-04-10 19:26:23 +02:00
Louis Gesbert
e19332522e Output subscope: improvements following review
Thanks @denismerigoux

This renames the "ScopeDef" variant from `SubScope` to `SubScopeInput`, which is
much clearer and avoids confusion with the `SubScope` elements in the surface
AST (which are really subscopes and not variables at this point).

And improves some error message by specialising depending on whether we are
dealing with a subscope or an explicit structure.
2024-04-10 18:38:50 +02:00
Louis Gesbert
8ae9701a4f Fix python name clash printing again, for non-ascii 2024-04-05 15:25:46 +02:00
Louis Gesbert
f71db385d5 Python backend: workaround func/var name clash 2024-04-05 14:45:17 +02:00
Louis Gesbert
75bf768264 Reformat 2024-04-04 10:56:56 +02:00
Louis Gesbert
0ec04c4925 Branch cleanup and test outputs update
Lots of tests have a new warning because they were calling subscopes without
using their outputs. A better solution could be to mark these subscopes as
`output`, now that it's possible !
2024-04-04 10:55:21 +02:00
Louis Gesbert
cde9a66295 Output scopes and subscope variable rework done 2024-04-04 10:24:18 +02:00
Louis Gesbert
852bebd357 Completely remove subscope input vars (use local vars) 2024-04-04 10:24:18 +02:00
Louis Gesbert
f151a9a794 Wip: handling subscope calls as normal definitions
- for the moment we still have specific vars for subscope inputs (in scopelang)
- this causes trouble with default-embedding of scope calls
2024-04-04 10:24:18 +02:00
Louis Gesbert
4eeb8221f4 Fix var bindings in desugared->scopelang 2024-04-04 10:24:18 +02:00
Louis Gesbert
7951661981 Turn subscope-vars into scope vars
They are to become citizens of the same class if we want to allow
output-subscopes (without unnecessary complications like deconstructing and
reconstructing the same structure). And it's reasonable to assume that they
share the same namespace.

With this we should shortly collapse the (internal) ambiguity between

- `subscope.subvar`: access to a variable within a subscope
- `subscope.subfield`: access to a field of the output structure contained in a
  subscope variable

With the subscope a variable, these should now become strictly equivalent, so
the plan is that the first could be removed.
2024-04-04 10:24:18 +02:00
Louis Gesbert
eeaadef27c Output subscopes: implement syntax
required a little generalisation and explicit parsing errors to avoid conflicts,
but it remains reasonable
2024-04-04 10:24:18 +02:00
Louis Gesbert
adaaf735e6 'catala depends': allow multiple extensions 2024-03-20 14:41:10 +01:00
Louis Gesbert
619cafebb8 Reformat 2024-03-20 14:41:06 +01:00
Louis Gesbert
1a17098297 Move file functions that were in Cli to File
it's now possible because Globals where moved away
2024-03-19 15:26:32 +01:00
Louis Gesbert
36c8a7effc Sort strings in natural order when they contain numbers
Seeing results sorted as 1 10 11 2 doesn't look nice.
2024-03-19 15:26:32 +01:00
Louis Gesbert
4cec981f62 Move global options of Cli to their own module
This resolves a dependency cycle that would forbid `Cli` from using the modue
`File`, which was annoying.
2024-03-19 15:18:35 +01:00
Louis Gesbert
3c03da4a50 file.ml: add a function to cleanup relative paths 2024-03-14 14:04:52 +01:00
Louis Gesbert
99004ab1d9 catala depends fixes
- automatically include the directories of listed files
- work for files that don't define modules
2024-03-13 18:15:50 +01:00
Louis Gesbert
9bf441ae31 'catala depends': allow specifying multiple files
The return is a topological order over their joint dependencies.
NOTE: the specified files are now included in the returns
2024-03-12 16:04:59 +01:00
Louis Gesbert
dc6bfae75c Fixes for linking modules in the backends (in particular, Python) 2024-03-08 17:36:00 +01:00
Louis Gesbert
26c28bbd35 Fix line overflow message, and line offset errors 2024-03-08 17:36:00 +01:00
Louis Gesbert
95e3c4bedd Ensure we create the necessary target directories before opening output files 2024-03-08 17:36:00 +01:00
Louis Gesbert
e68e1244a5 Fix complexity of some string functions 2024-03-08 17:36:00 +01:00
Louis Gesbert
ff06ddf40c Fixing linking across modules for backends
- This adds a `catala depends` command that recursively tracks module dependency.
It can then be used by Clerk for linking.

- Generation of cmo object files are added for OCaml (we only built native
objects, but jsoo requires bytecode).

- Some fixes to the generation of value embed/deembed shims (related to types
coming from different modules ; add support for options ; etc.)
2024-03-08 17:36:00 +01:00
Louis Gesbert
70cbfdb9ac Add a CATALA_INCLUDE env variable
It'll help while we wait for the implementation of project-wide specifications.
2024-03-08 17:36:00 +01:00
Louis Gesbert
bc3add57ec Fix plugins lookup dir when Catala is installed to PATH 2024-03-08 17:36:00 +01:00
Louis Gesbert
346f401523 Disambiguate enum constructors from current module in priority 2024-03-08 17:36:00 +01:00
Louis Gesbert
8b3d7fb64b Repair the 'explain' plugin 2024-03-05 10:07:25 +01:00
Denis Merigoux
c2c46c431e
Adress @altgr's suggestion 2024-03-04 13:30:25 +01:00
Denis Merigoux
ad5dd6f2f6 Fix R compilation 2024-03-03 18:36:50 +01:00
Louis Gesbert
1ea77201ff Lcalc interpreter: fix passing of context arguments 2024-02-26 14:56:43 +01:00
Louis Gesbert
07b71656e7 Native/interpreter interface: handle option types 2024-02-26 14:56:43 +01:00
Louis Gesbert
ba9fc85b84 Make exception output consistent across the interpreters 2024-02-26 14:56:43 +01:00
Louis Gesbert
4a049080a4 CLI: replace interpret_lcalc by interpret --lcalc
This will make it easier when running tests to just toggle the different flags
2024-02-26 14:56:43 +01:00
Louis Gesbert
97ae62384e Add externals to scalc, working test with Python backend 2024-02-26 14:56:43 +01:00
Louis Gesbert
589833bca7 Make plugin load failures less verbose
In general you don't care unless you may have attempted to use one.
2024-02-26 14:56:43 +01:00
Louis Gesbert
e0928677b1 Small ocaml/js output rehaul
Print to json directly rather than depend on yojson and a ppx.

Note: this should be tested with the website in order to validate that the Json
output is 1-to-1.
(a second step could be to simplify this output, now that it's manual)
2024-02-21 11:28:56 +01:00
Louis Gesbert
4ee4992b54 Tweak multi-module LaTeX output 2024-02-16 16:36:15 +01:00
Louis Gesbert
f09edf443e Fix typo 2024-02-16 16:12:35 +01:00
Louis Gesbert
60371189ab Allow generation of one latex file from multiple sources 2024-02-15 20:54:24 +01:00
Louis Gesbert
5128da2ebe Correctly fail if extra arguments are supplied 2024-02-15 20:54:14 +01:00
Louis Gesbert
18ec4b3dd3 LaTeX backend: fix module name escaping 2024-02-15 20:54:14 +01:00
Louis Gesbert
eb4ba114d2 Add test for literate LaTeX output 2024-02-15 14:53:26 +01:00
Louis Gesbert
a2d82d01f5 pandoc: disable highlight of custom fenced blocks for now 2024-02-15 13:54:44 +01:00
Louis Gesbert
23287ef817 Literate output: add info about modules 2024-02-15 13:54:44 +01:00
Louis Gesbert
2f2924944a Syntax: add keywords in front of list filtering / arg-extremum
Closes #574
2024-02-14 13:55:03 +01:00
Louis Gesbert
bf0ef0b1f5 Allow access to intermediate variable states
Through the syntax `var_name state state_name`.

Addresses #567, but
- requires documentation
- explicitely accessing states of the variable being defined is not allowed at
  the moment (warning proposed in #567 requires a whole-expression check, which
  is better done some place else entirely)
2024-02-12 18:15:48 +01:00
Louis Gesbert
afcc435593 CI: fix the check for bad promoted files 2024-02-12 16:44:14 +01:00
Louis Gesbert
721597a70d Small additional simplification 2024-02-12 15:39:29 +01:00
Louis Gesbert
9ca952b518 Fix building of plug-ins 2024-02-12 10:48:12 +01:00
Louis Gesbert
e308ff8d02 Generalise the definition of lists of nested binders 2024-02-09 18:33:41 +01:00
Louis Gesbert
c124943a6e Repair broken unit-test 2024-02-09 18:32:19 +01:00
Louis Gesbert
12974b089f Printer: skip unit variables for conciseness 2024-02-07 17:54:12 +01:00
Louis Gesbert
a56d95d790 Typing: add a "assume operator types" mode
This allows for retyping after monomorphisation: a new function just extracts
the return type of the operator, without checking the operand types.

Also to avoid multiplying function arguments around the typer, the flags have
been gathered in a record that is included in the typing environment; it's ok to
give them default values as long as these are the strictest.
2024-02-07 17:41:04 +01:00
Louis Gesbert
ea512bfd5b The typer doesn't handle monomorphised code yet
so don't retype after monomorphisation, which is now possible as the pass itself
correctly preserves types.

In time the typer will need a special case to get knowledge of the new types and
modified operator types.
2024-02-06 18:00:45 +01:00
Louis Gesbert
df70c5dd57 Simplify monomorphisation, and preserve type annotations 2024-02-06 18:00:25 +01:00
Louis Gesbert
e5fe02fd84 Interpreter: avoid rebuilding unchanged values
Closes #540 ; it was a leftover from when we were still exploring how best to
type this function.
2024-02-05 16:28:56 +01:00
Louis Gesbert
7f5b56e8f2 Interpreter: remove no longer needed empty propagations 2024-02-05 16:28:56 +01:00
Louis Gesbert
870716a3f8 Factorise a bit more with more arguments to Expr.map
allowing a safer way to translate types both in expressions and annotations, and
clarifying the code of the dcalc->lcalc translation
2024-02-05 16:28:56 +01:00
Louis Gesbert
61c105c365 Add one more trivial optimisation 2024-02-05 11:01:55 +01:00
Louis Gesbert
5cb8ba805b List detuplification: better intermediate vars namings
for more readable code
2024-02-05 11:01:55 +01:00
Louis Gesbert
7b43f393c5 Add some optimisations to nested maps 2024-02-05 11:01:55 +01:00
Denis Merigoux
afa8ee44bf
Delete duplicate code from 9d3550374d 2024-02-01 17:23:31 +01:00
Denis Merigoux
d7e71885c1
Formatting 2024-02-01 17:22:42 +01:00
Louis Gesbert
f90de90299 Monomorphisation: access types directly 2024-02-01 12:27:54 +01:00
Louis Gesbert
2dba54b906 Monomorphisation: simplify type collection 2024-02-01 12:22:31 +01:00
Louis Gesbert
9d3550374d Remove constructor matching on strings 2024-02-01 12:17:51 +01:00
Louis Gesbert
cfdaf94989 Define Type.Map 2024-02-01 10:10:25 +01:00
Louis Gesbert
e47a1fc220 Improve translation of typing upon dcalc -> lcalc
A little bit of effort enables us to propagate valid typing annotations, making
subsequent typing re-inference easier (and avoiding a traversal just to remove
type annotations)
2024-01-31 19:15:27 +01:00
Louis Gesbert
7a4ac4364b Mark closure conversion as untyped
since it doesn't correctly propagate and update types. (Ideally it would, but
otherwise it would be better to remove the type annotations on the fly instead
of introducing wrong ones then cleaning them up).
2024-01-31 17:52:06 +01:00
Louis Gesbert
e8e112d7f7 Add tuples to the Python backend 2024-01-31 11:02:03 +01:00
Louis Gesbert
5d233f4532 Fix warning 2024-01-29 11:37:42 +01:00
Denis Merigoux
a033f02689
Restore tests 2024-01-29 11:06:48 +01:00
Denis Merigoux
b48fb0e223
Array compilation to C is OK 2024-01-26 20:15:32 +01:00
Denis Merigoux
3e807ae071
Remove warnings 2024-01-26 17:53:49 +01:00
Denis Merigoux
a39b67bf12
Merge branch 'master' into c_backend 2024-01-26 17:43:07 +01:00
Louis Gesbert
371f9554b8 Support for list recombinations
The primary use-case for this was to be able to run computations on a list of
structures, then return an updated list with some fields in the structures
modified : that is what we need for distribution of tax amounts among household
members, for example.

This patch has a few components:

- Addition of a test as an example for tax distributions

- Added a transformation, performed during desugaring, that -- where lists are
  syntactically expected, i.e. after the `among` keyword -- turns a (syntactic)
  tuple of lists into a list of tuples ("zipping" the lists)

- Arg-extremum transformation was also fixed to use an intermediate list instead
  of computing the predicate twice

- For convenience, allow to bind multiple variables in most* list
  operations (previously only `let in` and functions allowed it)

- Fixed the printer for tuples to differentiate them from lists

*Note: tuples are not yet allowed on the left-hand side of filters and
arg-extremums for annoying syntax conflict reasons.
2024-01-26 11:29:33 +01:00
Louis Gesbert
bc90a7b890 Add (internally) a map2 operator 2024-01-26 11:22:12 +01:00
Louis Gesbert
a9f8fa36b8 Reduce default verbosity of invariant checks
they break the tests too often for no good reason
2024-01-25 18:18:43 +01:00
Louis Gesbert
7b25a42970 Better version handling
Always generate the version through git when possible, and encode that within
the binaries so that `catala --version` does'nt give misleading information.

Previously we used dune's builtin functionality, but that resorts to a hack at
install time which is unpleasant and doesn't work with our use of `opam
install`.

The cost is a re-linking of catala_utils and the binaries upon git commit, which
is hardly noticeable.
2024-01-24 11:41:34 +01:00
Denis Merigoux
34c62a73c1
Improve missing field error message 2024-01-23 12:05:18 +01:00
Denis Merigoux
8a139f6a3c
Work on arrays 2024-01-22 16:49:58 +01:00
Louis Gesbert
7636a6e8d5 CI: cleanup the exposed artifacts 2024-01-22 13:58:32 +01:00
Louis Gesbert
81eb7bf6d2 CI: Fix artifact source dir 2024-01-20 11:51:01 +01:00
Louis Gesbert
c336a7bb62
[WIP] Rehaul CI to run examples and generate artifacts again (#562) 2024-01-19 18:34:24 +01:00
Louis Gesbert
1c2c41b2ff Allow literal scope output structures 2024-01-19 15:43:35 +01:00
Louis Gesbert
c006c3343e Rehaul CI to run examples and generate artifacts again
this requires to fetch catala-examples and french-law from their own repos

Restrict static builds and publication to master
2024-01-18 16:14:27 +01:00
Louis Gesbert
d9a17db4c0 Fix running inline tests
Warning: one of them is broken and was disabled
2024-01-18 16:14:27 +01:00
Denis Merigoux
50d3164f36
Restore C compilation 2024-01-17 17:26:41 +01:00
Denis Merigoux
5310e47e5b
Fix monomorphization problems with [TAny] left 2024-01-17 16:03:20 +01:00
Denis Merigoux
0a8fdde7de
Fix monomorphization 2024-01-17 14:02:32 +01:00
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