Commit graph

42 commits

Author SHA1 Message Date
Leonardo de Moura
afd54039ab chore(library): remove >>, we should use *> 2018-09-12 17:31:21 -07:00
Leonardo de Moura
9e305a5f26 chore(library): remove return, we should use pure 2018-09-12 16:51:11 -07:00
Sebastian Ullrich
2823bebd23 refactor(library/init/lean/parser/parsec): message.pos: replace with iterator
This allows efficient recovery from a parse error as well as implementing
`has_to_string` for `message`
2018-07-30 10:38:00 -07:00
Sebastian Ullrich
65fd050b83 feat(library/init/lean/parser/parsec): add custom error message type 2018-07-27 14:29:50 -07:00
Sebastian Ullrich
72b255d4e1 chore(library/init/lean/parser/parser_t): rename module and type to parsec to avoid nested use of parser 2018-07-12 10:35:20 +02:00
Sebastian Ullrich
7ae87705c2 feat(library/init/lean/parser/parser_t): introduce monad_parser 2018-06-15 17:48:20 +02:00
Leonardo de Moura
1bae8f8eab refactor(library/init/lean/ir/parser): parser.lean => parser_t.lean 2018-06-05 08:00:13 -07:00
Sebastian Ullrich
0f7c0ac8bf feat(init/lean/parser/parser): make a monad transformer
Also move parser combinators into the more specific namespace `init.lean.parser.parser_t`.
2018-06-04 12:57:23 +02:00
Leonardo de Moura
acdcbdb71e feat(library/init/lean/ir): add instructions for (big) integer arithmetic 2018-05-17 18:17:23 -07:00
Leonardo de Moura
af1a5fe874 feat(library/init/lean/ir): add x : ty := y instruction
It is useful when we are not producing IR in SSA.
2018-05-17 15:44:13 -07:00
Leonardo de Moura
dede61b122 feat(library/init/lean/ir): add tag and tag_ref instructions 2018-05-17 14:51:41 -07:00
Leonardo de Moura
5d53eccb59 feat(runtime): string support 2018-05-17 13:11:47 -07: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
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
5cfb442f2c feat(library/init/lean/ir): add compilation unit initializer/finalizer 2018-05-15 11:57:53 -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
f727781792 fix(library/init/lean/ir/parser): label 2018-05-13 11:35:08 -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
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
ad61772c72 feat(library/init/lean/ir): add is_null
We will use this instruction for compiling inductive datatypes such as
`option A` where `A` is represented as an `object`.
In this case, we can represent `some a` as `a` (without any extra memory
allocation), and `none` as the null pointer.
2018-05-10 12:47:44 -07:00
Leonardo de Moura
e882d9d7cf feat(library/init/lean/ir): add array_size, sarray_size and string_len 2018-05-10 10:02:16 -07:00
Leonardo de Moura
68458aa97b refactor(library/init/lean/ir): array operations 2018-05-10 09:52:00 -07:00
Leonardo de Moura
4862da3fca feat(library/init/lean/ir): add array_pop and sarray_pop 2018-05-10 09:24:48 -07:00
Leonardo de Moura
f1535121b9 refactor(library/init/lean/ir): combine unary instructions 2018-05-10 09:19:13 -07:00
Leonardo de Moura
655cfbf3b0 refactor(library/init/lean/ir): read and sread instructions are now binop 2018-05-10 08:47:16 -07:00
Leonardo de Moura
7b89a8c910 chore(library/init/lean/ir): copy_array ==> array_copy, copy_sarray ==> sarray_copy 2018-05-10 08:36:33 -07:00
Leonardo de Moura
d2c4918ca3 chore(library/init/lean/ir): shared ==> is_shared, scalar ==> is_scalar 2018-05-10 08:30:28 -07:00
Leonardo de Moura
fc840eab3f feat(library/init/lean/ir): add emit_unop 2018-05-09 18:20:46 -07:00
Leonardo de Moura
7d196f58c3 chore(library/init/lean/ir): remove ashr 2018-05-09 17:43:25 -07:00
Leonardo de Moura
5baae4724f feat(library/init/lean/ir): distinguish free and dealloc 2018-05-09 17:43:12 -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
f7c4134452 refactor(library/init/lean/ir): we can use the cast instruction for boxing/unboxing 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
Leonardo de Moura
e6b509781f feat(library/init/lean/ir/ir): platform independent object size and offset 2018-05-07 18:07:04 -07:00
Leonardo de Moura
88082cd16d fix(library/init/lean/ir/parser): case 2018-05-06 10:11:58 -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
beae2d936b chore(library/init/lean/ir/parser): remove leftover 2018-05-02 12:44:23 -07:00
Leonardo de Moura
6e2ebb5fab feat(library/init/lean/ir): add IR instruction parser 2018-05-01 17:45:50 -07:00