Commit graph

4004 commits

Author SHA1 Message Date
Leonardo de Moura
8cb7511a91 feat(runtime/lean_obj): natural number support 2018-05-16 10:28:51 -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
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
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
31ce1a23e7 fix(library/init/lean/ir/extract_cpp): add support for bignum literals 2018-05-14 11:12:49 -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
ba76d86a38 feat(library/init/lean/ir/extract_cpp): add emit_app, fix assignment 2018-05-14 09:28:17 -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
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
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
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
Leonardo de Moura
aba3d08372 fix(library/init/lean/ir/extract_cpp): minor fixes 2018-05-10 10:54:43 -07:00
Leonardo de Moura
3ce96ae323 chore(tests/lean/parser1): fix test 2018-05-10 10:30:47 -07:00
Leonardo de Moura
d5fd86791d chore(tests/lean/run/ext_eff*): reduce number of iterations
My machine was taking forever to run these tests in debug mode.
2018-05-09 10:52:33 -07:00
Leonardo de Moura
14e19502f0 chore(tests/lean/run/type_class_performance1): remove #exit 2018-05-09 10:24:45 -07:00
Leonardo de Moura
d05e93f763 test(tests/lean/run/name_mangling): add tests for name mangling 2018-05-09 10:10:00 -07:00
Leonardo de Moura
b77cd740a8 test(tests/lean/run/display_hw_term_hack_deps): add helper function for displaying functions that use wf_term_hack 2018-05-08 16:28:42 -07:00
Sebastian Ullrich
4ed7b57903 test(tests/lean/run/ext_eff): add IO exception handling example 2018-05-08 17:29:12 +02:00
Leonardo de Moura
50f883a946 chore(tests/lean/parser1): fix test 2018-05-07 18:11:41 -07:00
Leonardo de Moura
e40f37b08e feat(library/init/lean/ir): add type checker 2018-05-07 18:07:04 -07:00
Leonardo de Moura
d85c30fde1 perf(library/init/data): mark usize, uint16, uint32 and uint64 as [irreducible]
Without these annotations, Lean will timeout when trying to synthesize
the type class instance `decidable_eq uint32`. The type class resolution
problem will produce the unification problem:
```
decidable (@eq uint32 a b) =?= decidable (@eq usize ?x ?y)
```
which Lean tries to solve by assigning `?x := a`.
During the assignment, the types of `?x` and `a` are unified with "full
force". Thus, we get the constraint
```
usize_sz =?= uint32_sz
```
which will take forever to be solved when peforming the computation in
unary arithmetic.

Remark: this commit also makes sure that `type_context` will not unfold
irreducible definitions when trying to unify/match the types.

The new test `type_class_performance1.lean` exposes the problem fixed
by this commit.
2018-05-07 18:07:04 -07:00
Leonardo de Moura
79f351d177 fix(library/init/lean/ir): parser and test 2018-05-07 18:07:04 -07:00
Leonardo de Moura
0a9bd8caa8 chore(library/init/lean/ir): improve sizet syntax 2018-05-07 18:07:04 -07:00
Sebastian Ullrich
91e3e2435a test(tests/lean/run/ext_eff): document quadratic run time issue and implement solution from paper
~3x slowdown on right-associated binds
2018-05-07 23:58:17 +02:00
Leonardo de Moura
88082cd16d fix(library/init/lean/ir/parser): case 2018-05-06 10:11:58 -07:00
Leonardo de Moura
e2e124626f feat(library/init/lean/ir): add elim_phi function 2018-05-06 10:07:44 -07:00
Leonardo de Moura
d5fe509c36 chore(*): remove end after each match-expression
`end` is not optional anymore
2018-05-04 11:30:06 -07:00
Sebastian Ullrich
7da6d5c50d test(tests/lean/run/ext_eff): add extensible effects monad example 2018-05-04 19:44:33 +02:00
Leonardo de Moura
7aeae54522 chore(tests/lean/trust0/basic): fix test 2018-05-03 15:57:59 -07:00
Leonardo de Moura
acade175b6 feat(library/init/data/array): store dimension in the array
The array dimension is now stored inside the array.
The main motivation is that it reflects the actual runtime implementation.
We need to store the array size to be able to GC it.
So, it feels silly to have the array size stored in each array object,
but we cannot use this information.
For example, in the `hashmap` we implemented the bucket array using
`array`, and we store the `size` of the array.
Same for the Lean3 `buffer` object.
The `buffer` object doesn't even need to exist.
The actual `array` implementation is the `buffer`
2018-05-03 15:43:03 -07:00
Leonardo de Moura
d9101cb950 chore(tests/lean/parser1): fix test 2018-05-02 17:37:55 -07:00
Leonardo de Moura
bf71068b14 feat(library/init/lean/ir): parse IR definitions 2018-05-02 16:59:50 -07:00
Leonardo de Moura
0d49ae3f69 feat(library/init/lean/parser): add not_followed_by and not_followed_by_sat
The new parsers are useful to implement the longest match rule.
2018-05-02 15:55:57 -07:00
Leonardo de Moura
6e2ebb5fab feat(library/init/lean/ir): add IR instruction parser 2018-05-01 17:45:50 -07:00
Leonardo de Moura
263391bdbb refactor(library/init/lean): add init/lean/parser/identifier 2018-05-01 11:53:55 -07:00
Leonardo de Moura
7305a7a65e feat(library/init/lean): identifier parser 2018-05-01 10:29:34 -07:00
Leonardo de Moura
ba8b85f4c0 chore(library/init/lean/parser/parser): adjust variable names 2018-04-30 16:36:09 -07:00
Leonardo de Moura
cd10ca74f7 chore(tests/lean/string_imp): fix test 2018-04-30 16:15:51 -07:00
Leonardo de Moura
9879cb46be feat(library/init/lean/parser/parser): store offset in error messages 2018-04-30 16:08:52 -07:00
Leonardo de Moura
f20f50254c feat(library/init/data/string/basic): add string.line_column 2018-04-30 15:55:34 -07:00
Leonardo de Moura
62d425073e feat(library/init/data/string/basic): add string.iterator.offset 2018-04-30 15:43:51 -07:00
Leonardo de Moura
0405a67a70 feat(library/init): add wf_term_hack (unsound) axiom
We use the axiom instead of `sorry` to avoid a tsunami of warnings.
2018-04-30 11:06:51 -07:00
Leonardo de Moura
9b5297901b fix(tests/lean/trust0/basic): test 2018-04-30 10:13:35 -07:00
Leonardo de Moura
12f2831f9f test(tests/lean/parser1): add parser tests 2018-04-28 15:58:50 -07:00
Leonardo de Moura
c427fb4086 refactor(*): create library/init/lean folder
The new folder will contain the new parser, macro expander and compiler.
This commit also renames the namespace for the old parser `lean3.parser`
2018-04-27 08:02:40 -07:00
Leonardo de Moura
9e9a0d103f feat(library/vm/vm_string): add fast string.iterator.remaining 2018-04-26 18:03:41 -07:00