298 Commits

Author SHA1 Message Date
Gabriel Scherer
2875adb603 compile.scm: lower ERecord 2020-12-02 10:09:23 +01:00
Gabriel Scherer
a32b5a4f4b compile.scm: lower constructors 2020-12-02 10:09:23 +01:00
Gabriel Scherer
a86494145b compile.scm: lower constants 2020-12-02 10:09:23 +01:00
Gabriel Scherer
1202e82461 compile.scm: introduce a (currently-empty) distinction between 'lowering' and code production 2020-12-02 10:09:23 +01:00
Gabriel Scherer
9b27099bab factorize vhash-replace calls on the environment 2020-12-01 12:51:00 +01:00
Gabriel Scherer
61f8c29e12 compile.scm: minor refactor 2020-12-01 12:49:32 +01:00
Gabriel Scherer
8604066454 compile.scm: match in compile-def 2020-12-01 12:10:30 +01:00
Gabriel Scherer
3b640bb5bc compile.scm: match in compile-type 2020-12-01 12:10:30 +01:00
Gabriel Scherer
f51a735e6a compile.scm: refactor get-fun-body 2020-12-01 12:10:00 +01:00
Gabriel Scherer
470c006660 [minor] cut some long lines 2020-12-01 12:07:11 +01:00
Nathanaël Courant
729a7c524d Add recursive closures 2020-12-01 11:38:18 +01:00
Nathanaël Courant
85fb44073c Add command arguments to compile.scm 2020-12-01 09:02:13 +01:00
Nathanaël Courant
68532527cf Handle externally raised exceptions 2020-11-30 21:32:14 +01:00
Gabriel Scherer
09979f89cb compile.scm: match in expr-fv 2020-11-30 21:29:01 +01:00
Gabriel Scherer
719dbf9973 compile.scm: record for function arguments 2020-11-30 21:29:01 +01:00
Gabriel Scherer
94adbfe3b7 compile.scm: record for definitions 2020-11-30 21:29:01 +01:00
Gabriel Scherer
7b4984e1d8 compile.scm: match in compile-expr 2020-11-30 21:29:01 +01:00
Gabriel Scherer
7e4e53dd3d compile.scm: records for switch clauses 2020-11-30 21:29:01 +01:00
Gabriel Scherer
1744db1ffe compile.scm: records for switch consts and blocks 2020-11-30 21:29:01 +01:00
Gabriel Scherer
a767fee54c compile.scm: match 2020-11-30 21:29:01 +01:00
Gabriel Scherer
b162b7f1dc compile.scm: match 2020-11-30 21:29:01 +01:00
Gabriel Scherer
18b1de0ba3 compile.scm: add records 2020-11-30 21:29:01 +01:00
Gabriel Scherer
1523ea9454 compile.scm: add match 2020-11-30 21:29:01 +01:00
Nathanaël Courant
4ee49920e1 Delete old miniml interpreter 2020-11-30 17:05:17 +01:00
Nathanaël Courant
74bdd147aa Move interpreter to its own folder 2020-11-30 16:31:12 +01:00
Gabriel Scherer
78082a2091 compile.scm: readable version of split-pattern-matching 2020-11-30 10:31:28 +01:00
Gabriel Scherer
e10a597d1d pattern-matching example: fv-env-pat 2020-11-30 10:31:28 +01:00
Gabriel Scherer
89c19f5de5 record example: environments 2020-11-30 10:31:28 +01:00
Gabriel Scherer
0e3af11a58 enable records and pattern-matching 2020-11-30 10:31:28 +01:00
Gabriel Scherer
0b8586fe9d compile.scm: support 'function' 2020-11-28 17:56:15 +01:00
Gabriel Scherer
3642339da7 compile.scm: pattern clauses can start with a bar easily 2020-11-28 17:56:15 +01:00
Gabriel Scherer
c5f6a46871 avoid nested patterns in interp.ml 2020-11-28 17:56:15 +01:00
Gabriel Scherer
122c32ac89 compile.scm: support toplevel 'let () = e' 2020-11-28 17:56:15 +01:00
Gabriel Scherer
0d2924474e compile.scm: (|>) and (@@) 2020-11-28 17:56:15 +01:00
Gabriel Scherer
4b3b404eff [minor] fix some innocuous warnings in the OCaml code 2020-11-28 17:56:15 +01:00
Gabriel Scherer
ea4af6d5b4 miniml: support patterns in function arguments
The implementation is fairly naive, we generate "dummy" argument names
for non-variable patterns, and a "match" in the body. This is
a relatively natural extension of the compilation of optional
parameters.
2020-11-28 17:56:15 +01:00
Gabriel Scherer
2fb1bf3956 [minor] refactor free-variable computations for patterns 2020-11-28 17:56:15 +01:00
Gabriel Scherer
e96e0d106b compile.scm: support local functions 2020-11-28 10:10:01 +01:00
Gabriel Scherer
f6baef86cf back to miniml: avoid polymorphic variant 2020-11-28 10:10:01 +01:00
Nathanaël Courant
a8f32312d6 Add let open 2020-11-28 10:09:02 +01:00
Gabriel Scherer
db3be50ce9 primitives: more int64 primitives 2020-11-24 14:38:53 +01:00
Gabriel Scherer
c95321805b eval.ml: support pattern-matching on arrays 2020-11-24 14:38:53 +01:00
Gabriel Scherer
607b1bc924 primitives: caml_float_of_string 2020-11-24 14:38:53 +01:00
Gabriel Scherer
688f6aa653 recursive module units: really use stateful storage
The previous implementation used a pervasive store passed as
a parameter of the interpreter configuration/state. This approach
worked correctly for (recursive) module/unit definitions:
dereferencing accesses to an aliased functor are made in the
current-time unit store, rather than through the (partly
uninitialized) alias-definition-time store. But it is defeated by
functors, that close over their definition-time environment: their
application results in modules evaluated in the alias-definition-time
environment, which miss module definitions.

See the testcase tests/functor-units-dependency.
2020-11-24 14:38:53 +01:00
Gabriel Scherer
1b6fe1bcae add a failing testcase 2020-11-24 14:38:53 +01:00
Gabriel Scherer
8670dcae7a add a minimal test framework 2020-11-24 14:38:53 +01:00
Gabriel Scherer
b3e3858553 add a minimal command-line interface -- through environment variables 2020-11-24 14:38:53 +01:00
Gabriel Scherer
70655bf514 readable failure messages should not be debug-mode-only features 2020-11-24 14:38:53 +01:00
Gabriel Scherer
3083bd1fe9 more primitives used in the compiler 2020-11-24 14:38:53 +01:00
Gabriel Scherer
9bbf49d906 support object-oriented features
We need to support the object-oriented code that can be found in the
native backend.
2020-11-24 14:38:53 +01:00