Commit graph

13966 commits

Author SHA1 Message Date
Sebastian Ullrich
696ba77b53 feat(frontends/lean/elaborator): anonymous constructor notation for ginductives 2018-05-17 14:14:00 +02:00
Leonardo de Moura
53d459911f refactor(library/init/lean/ir): RC instructions 2018-05-16 10:28:51 -07:00
Leonardo de Moura
8cb7511a91 feat(runtime/lean_obj): natural number support 2018-05-16 10:28:51 -07:00
Sebastian Ullrich
2cf731c607 feat(library/init/lean/trace.lean): add tracing structure and monad prototypes 2018-05-16 18:47:37 +02:00
Leonardo de Moura
ade8cb7296 chore(library/init/lean/ir): make it clear that big number may be a tagged pointer 2018-05-15 15:58:58 -07:00
Leonardo de Moura
6e1a64a3ed fix(library/init/lean/ir): change semantics of big number operations
Remark: only `inc`, `dec` and `decs` should modify the reference counters.
2018-05-15 15:52:54 -07:00
Leonardo de Moura
65b9da7a29 doc(library/init/lean/ir/ir): document operators 2018-05-15 15:31:27 -07:00
Leonardo de Moura
cf36d8b08e refactor(library/init/lean/ir): rename ir.instr constructors 2018-05-15 14:48:12 -07:00
Leonardo de Moura
272f80c799 feat(library/init/lean/ir): add string_push and string_append instructions 2018-05-15 14:27:10 -07:00
Leonardo de Moura
74767df5ff feat(library/init/lean/ir/extract_cpp): add initialize_prefix and finalize_prefix 2018-05-15 14:09:38 -07:00
Leonardo de Moura
be74e3f974 refactor(library/init/lean/ir): add init/lean/ir/instances.lean 2018-05-15 12:14:36 -07:00
Leonardo de Moura
0f2a8f09c2 chore(library/init/lean/ir): cleanup 2018-05-15 12:09:04 -07:00
Leonardo de Moura
5cfb442f2c feat(library/init/lean/ir): add compilation unit initializer/finalizer 2018-05-15 11:57:53 -07:00
Leonardo de Moura
3708a22484 feat(runtime/lean_obj): add lean_dbg_print_num 2018-05-15 11:57:53 -07:00
Sebastian Ullrich
839e65f27c test(tests/lean/run/handlers): add "Handlers in Action" example implementation 2018-05-15 18:50:12 +02:00
Leonardo de Moura
b1d8a17f1b fix(runtime): add init_module 2018-05-14 20:38:21 -07:00
Leonardo de Moura
52b5ab1514 doc(library/init/lean/ir/ir): document unary operators 2018-05-14 20:29:28 -07:00
Leonardo de Moura
168e7fa0cd chore(runtime/lean_obj): style 2018-05-14 17:27:25 -07:00
Leonardo de Moura
b0a4066695 test(tests/ir): add basic script for compiling IR definitions
The support libraries are currently hard coded.
2018-05-14 17:27:05 -07:00
Leonardo de Moura
8ee2f4fea1 feat(*): basic runtime string support 2018-05-14 16:52:55 -07:00
Leonardo de Moura
59f9de720d feat(library/init/lean/ir/lirc): we should support only C external names without mangling 2018-05-14 16:32:18 -07:00
Leonardo de Moura
f8bd816215 feat(library/system/io): add write_file 2018-05-14 16:05:29 -07:00
Leonardo de Moura
d166b69e2c feat(library/init/lean/ir/parser): add support for functions that do not return anything 2018-05-14 16:05:15 -07:00
Leonardo de Moura
aa1006d01b feat(library/init/lean/ir/extract_cpp): generate libleanruntime.a 2018-05-14 14:34:10 -07:00
Leonardo de Moura
0556412f8d refactor(*): add runtime folder
@kha The runtime folder includes what is needed to link a
standalone Lean program. It is still contains some unnecessary files.
We will be able to remove them after we release Lean4.
2018-05-14 14:23:56 -07:00
Leonardo de Moura
31ce1a23e7 fix(library/init/lean/ir/extract_cpp): add support for bignum literals 2018-05-14 11:12:49 -07:00
Leonardo de Moura
095d100a38 chore(util/debug): remove logtree dependency 2018-05-14 11:09:07 -07:00
Leonardo de Moura
4fa1022388 fix(gen/apply): emit #pragma once 2018-05-14 11:08:45 -07:00
Leonardo de Moura
914f6907dc chore(util/lean_obj): remove unnecessary includes 2018-05-14 11:08:16 -07:00
Leonardo de Moura
37201b9192 feat(library/init/lean/ir/extract_cpp): add emit_closure 2018-05-14 09:53:45 -07:00
Leonardo de Moura
c6de7ae4d1 fix(library/init/lean/ir/type_check): typo 2018-05-14 09:53:29 -07:00
Leonardo de Moura
ba76d86a38 feat(library/init/lean/ir/extract_cpp): add emit_app, fix assignment 2018-05-14 09:28:17 -07:00
Leonardo de Moura
11270591ff fix(library/init/lean/ir/extract_cpp): missing case at collect_used 2018-05-13 14:49:57 -07:00
Leonardo de Moura
12854dc944 feat(library/init/lean/ir/extract_cpp): include uncurry 2018-05-13 14:47:54 -07:00
Leonardo de Moura
c00117a269 fix(library/init/lean/ir/ssa_check): bug 2018-05-13 14:43:13 -07:00
Leonardo de Moura
344de0e42e feat(library/init/lean/ir/extract_cpp): emit header of all functions used in a compilation unit 2018-05-13 14:40:52 -07:00
Leonardo de Moura
8b0a35fa5d feat(library/init/lean/ir/extract_cpp): add uncurry for functions with many arguments 2018-05-13 13:28:18 -07:00
Leonardo de Moura
f727781792 fix(library/init/lean/ir/parser): label 2018-05-13 11:35:08 -07:00
Leonardo de Moura
fbac1d45a3 refactor(library/init/control/combinators): move nat.mrepeat to combinators 2018-05-13 11:34:39 -07:00
Leonardo de Moura
b7f194d389 feat(library/init/lean/ir): allow arbitrary C++ identifiers to be assigned to declarations 2018-05-13 11:04:42 -07:00
Leonardo de Moura
cfacb515c1 feat(library/init/lean/ir): add IR simple frontend 2018-05-13 10:45:26 -07:00
Leonardo de Moura
1039951b09 fix(library/init/lean/ir/extract_cpp): typo 2018-05-13 10:33:56 -07:00
Leonardo de Moura
1b6d670ad5 chore(library/init/lean/ir/parser): missing decl 2018-05-13 10:33:34 -07:00
Leonardo de Moura
448f6a9ca4 fix(library/init/lean/ir/ssa_check): arguments are "defined" in first basic block 2018-05-13 10:33:00 -07:00
Leonardo de Moura
5c3cbbf2cd feat(library/init/lean): add lean.closure_max_args 2018-05-13 08:40:46 -07:00
Leonardo de Moura
1ab4c9f8bf feat(gen/apply): simplify over-application case and avoid quadratic blowup
The over-application doesn't occur very often in practice.
The new version adds an extra "copy" step, but it avoids the quadratic
blowup in code size.
Xavier Leroy reports that only 5% of all calls are over-applications
in his experiments.
In Lean3, 6.59% of all calls performed to compile corelib are "over",
and we did not implement any fancy optimization.
2018-05-12 15:10:26 -07:00
Leonardo de Moura
d02c36df18 chore(gen/apply): style 2018-05-11 18:01:58 -07:00
Leonardo de Moura
1d69493b83 feat(gen/apply): add generator for apply
It generates the functions at `util/apply.h` that are used by
the Lean runtime.
2018-05-11 17:54:09 -07:00
Leonardo de Moura
0c785f8ab7 feat(library/init/data): add instances for has_repr (id A) and has_to_string (id A) 2018-05-10 17:37:57 -07:00
Leonardo de Moura
224fdc7a78 refactor(library/init/lean/ir): platform dependent IR
Motivation: in 64-bit machines, we can store boxed uint32 values as a
tagged pointer. In 32-bit machines, we need to allocated an object (like
Haskell) to store the uint32 value. So, the generated bytecode is quite
different in each platform.

This change also allow us to simplify the IR. Example: we don't need the
type `sizet` anymore.

Impact: To be able to bootstrap in both platforms,
we will have to store two versions of the generated code: 32 and 64
versions. In principle, we only need to store the 64-bit version,
and use cross-compilation to build the 32-bit version.
2018-05-10 13:15:02 -07:00