Commit graph

3333 commits

Author SHA1 Message Date
Leonardo de Moura
5bbc80fdad chore(*): fixed token.lean 2019-03-21 15:06:44 -07:00
Leonardo de Moura
300aae08b3 chore(*): more fixes 2019-03-21 15:06:44 -07:00
Leonardo de Moura
35ddd49e7a chore(frontends/lean/structure_cmd): toParent instead of to_Parent 2019-03-21 15:06:44 -07:00
Leonardo de Moura
ac27bd092b chore(*): small fixes 2019-03-21 15:06:44 -07:00
Leonardo de Moura
e0b0ca4830 chore(*): adapt C++ code to camelCase 2019-03-21 15:06:43 -07:00
Leonardo de Moura
bc75a24127 chore(library, frontends): use camelCase for attribute names 2019-03-21 15:06:43 -07:00
Leonardo de Moura
039e7fab48 refactor(library): add suffixes.h with commonly used suffixes such as brec_on 2019-03-21 15:06:43 -07:00
Sebastian Ullrich
b325908d4a chore(frontends/lean/vm_elaborator): rename to lean_elaborator, update some comments 2019-03-16 19:29:12 +01:00
Sebastian Ullrich
e19ed79414 feat(shell/lean): pass environment to and from Lean, remove environment.mk_empty axiom
/cc @leodemoura

I didn't remove the implementation of `environment.mk_empty`, we may want to use
it in tests.
2019-03-16 19:27:16 +01:00
Leonardo de Moura
0b7d987699 feat(frontends/lean, library/init/lean): opaque constants
@kha I have added support for opaque constants to the old C++ frontend,
and made sure the new frontend can still parse `library/init/core.lean`.
The kernel should enforce that opaque constants are really opaque, and
the following example should fail
```
constant x : nat := 0
theorem foo : x = 0 := rfl
```
If it doesn't, it is a bug.

Here are some remaining issues:
1- `environment.mk_empty` is currently an axiom because we cannot create
an inhabitant of an opaque type. A possible solution is to use
`option environment` instead of `environment`.

2- There is no support for opaque constants in the new
frontend. However, I modified it to handle axioms, and fixed the literal
values with decl_cmd_kind. I tried to mark some of my changes with
comments, but it is probably much easier for you to just check the
commit change list.

3- I did not add any support for automatically constructing `e`
at `constant x : t := e`. I think we can do this later
after we replace the old frontend with the new one. BTW, it took only a
few minutes to provide the inhabitants manually.
2019-03-15 17:41:44 -07:00
Leonardo de Moura
ecdb9d6df0 feat(library/init, frontends/lean): add abbreviation for abbreviation 2019-03-15 16:01:25 -07:00
Leonardo de Moura
0888dee25e chore(*): meta ==> unsafe 2019-03-15 15:04:40 -07:00
Leonardo de Moura
c862ce4a75 feat(runtime, library/init/data/string/basic): add utf8_pos
`utf8_pos` is a low level alternative for `string.iterator`.
TODO: implement `string.iterator` using it.
2019-03-09 12:30:19 -08:00
Leonardo de Moura
b5b2adea49 refactor(runtime): proper external objects without vtable
A C++ vtable at `external_object` is bad because it prevents users
from implementing external object in different programming languages.

Another problem was memory leaks because of the vtable in the
beginning of the object.

cc @kha
2019-03-07 10:26:05 -08:00
Sebastian Ullrich
430fb81f69 fix(library/init/lean/parser/term,frontends/lean/builtin_exprs): @& should have higher rbp than -> 2019-03-07 14:35:25 +01:00
Leonardo de Moura
3e0c90d17d fix(frontends/lean/vm_elaborator): incorrect arity 2019-03-06 16:52:03 -08:00
Sebastian Ullrich
f2a161e5a9 feat(library/init/lean/util): Lean API for profiler 2019-03-06 10:37:38 +01:00
Leonardo de Moura
9cc41c4f3d chore(frontends/lean/inductive_cmds): disable broken check
@kha I have disabled this check. It was implemented 2 years ago by
Daniel, and I don't want to fix it. It seems you have already fixed a
bug there. AFAICT, this check is just for improving error messages.
I believe we may not even need it since the kernel now supports nested
inductive types. AFAIR, Daniel implemented this check here because the
inductive compiler was introducing a lot of auxiliary declarations
that were making the kernel error messages unreadable.
2019-03-04 11:05:21 -08:00
Sebastian Ullrich
4c357dfbd6 fix(frontends/lean/decl_attributes): fix attribute parsing in old frontend 2019-02-15 12:13:45 -08:00
Sebastian Ullrich
f6fde1a53d fix(frontends/lean/vm_elaborator): correctly set up declaration_info_scope 2019-02-15 12:13:45 -08:00
Sebastian Ullrich
d083f8457a feat(frontends/lean/vm_elaborator): use attribute parsers 2019-02-15 12:13:45 -08:00
Sebastian Ullrich
a6ac98966a refactor(library/attribute_manager): parse attribute data from pexpr instead of abstract_parser 2019-02-15 12:13:45 -08:00
Sebastian Ullrich
7bea9a1bea chore(frontends/lean/vm_elaborator): ignore [extern] for now 2019-02-14 14:07:05 -08:00
Sebastian Ullrich
7cffe6935e feat(frontends/lean/vm_elaborator): port to new runtime 2019-02-14 14:07:05 -08:00
Leonardo de Moura
f41e4dac72 fix(frontends/lean): must set m_gen_code = false for auxiliary declarations of extern declarations
We cannot check the `[extern]` attribute because the auxiliary
declarations are compiled before we even define the main declaration
and set the attribute.
We should consider a better design in the future where we first define
all auxiliary and main definitions, then set the attributes, and then
compile the code.

cc @kha
2019-02-12 17:52:06 -08:00
Leonardo de Moura
9675b7c952 fix(frontends/lean/elaborator): ignore mdata when processing field notation 2019-02-11 17:29:38 -08:00
Leonardo de Moura
bc4e06666b chore(*): avoid 0-ary extern declarations 2019-02-11 13:21:17 -08:00
Leonardo de Moura
348ccf533c feat(library/compiler): borrowed annotations 2019-02-11 10:08:47 -08:00
Leonardo de Moura
7e8f9e6f66 feat(library/compiler): add [extern] attribute 2019-02-09 18:53:44 -08:00
Sebastian Ullrich
789252ad2b chore(frontends/lean/elaborator): show traces from node! 2019-02-07 14:16:28 +01:00
Sebastian Ullrich
fce7aca812 feat(frontends/lean/vm_elaborator): recover from unknown identifiers 2019-02-07 14:16:28 +01:00
Leonardo de Moura
f38de694b0 feat(frontends/lean/definition_cmds): compile code after attributes have been applied
@kha do you see any problem with this change?
2019-02-06 12:14:53 -08:00
Leonardo de Moura
9bd4a7e9b4 chore(frontends/lean): fix clang++ warnings at C++
@kha, it was a `class parser` vs `struct parser`.
I just fixed the warning by using `struct parser` everywhere.
It is ugly, but we will eventually delete the old parser.
2019-01-30 15:19:34 -08:00
Sebastian Ullrich
2d9a16fd24 refactor(library/module_mgr): remove 2019-01-25 20:12:11 +01:00
Leonardo de Moura
214471a2c9 feat(library/abstract_parser): add parse_name virtual method 2019-01-24 13:54:05 -08:00
Sebastian Ullrich
74d80444ff fix(frontends/lean/vm_elaborator): elab_attribute_cmd 2019-01-21 17:53:05 +01:00
Sebastian Ullrich
7001eee350 fix(frontends/lean/vm_elaborator): never resolve to section variables in patterns 2019-01-20 18:48:51 +01:00
Sebastian Ullrich
c22fbb5cde feat(library/init/lean,frontends/lean/vm_elaborator): set_option 2019-01-20 18:21:41 +01:00
Sebastian Ullrich
dcd3b3dc5d fix(library/init/lean/elaborator): section variables need to be preresolved as well
In
```
section binary
variables {α : Type u} {β : Type v}
variable f : α → α → α
local infix * := f
def commutative        := ∀ a b, a * b = b * a
end binary
```
the expansion of `*` applies a macro scope to `f`, so we need to resolve it
before that
2019-01-20 13:22:08 +01:00
Sebastian Ullrich
543c3d21ff fix(frontends/lean/vm_elaborator): match and equations, oof 2019-01-19 15:20:52 +01:00
Leonardo de Moura
a001806996 feat(library/compiler/compiler): generate boxed version of builtin constants 2019-01-18 15:43:06 -08:00
Sebastian Ullrich
c1534fd476 feat(frontends/lean/vm_elaborator): [recursor] arguments 2019-01-17 19:57:00 +01:00
Sebastian Ullrich
a23df570fc fix(library/init/lean/elaborator): match 2019-01-17 19:57:00 +01:00
Sebastian Ullrich
175a9f0f5c fix(frontends/lean/vm_elaborator): skip local refs created deep inside elab_defs 2019-01-17 19:57:00 +01:00
Sebastian Ullrich
3e8e823893 fix(frontends/lean/vm_elaborator): preserve internal name of section variables 2019-01-17 19:57:00 +01:00
Sebastian Ullrich
0509cfcf99 fix(frontends/lean/vm_elaborator): name to obj 2019-01-17 19:57:00 +01:00
Sebastian Ullrich
3611eda136 fix(frontends/lean/vm_elaborator): message order 2019-01-17 19:57:00 +01:00
Sebastian Ullrich
cbed0d232d fix(frontends/lean/definition_cmds): collect implicit locals in both frontends 2019-01-17 18:55:43 +01:00
Sebastian Ullrich
16d7ee5aff fix(frontends/lean/vm_elaborator): pattern variables 2019-01-17 17:06:52 +01:00
Sebastian Ullrich
8cc35b854b feat(library/init/lean/{expander,elaborator}): variable(s) 2019-01-17 17:06:52 +01:00