Commit graph

16 commits

Author SHA1 Message Date
Leonardo de Moura
89afabae29 refactor(library/init/lean/parser/parsec): make sure custom error message doesn't need to be inhabited 2018-10-21 10:57:23 -07:00
Leonardo de Moura
88de81077c feat(library/compiler/specialize): do not specialize instances unless they are marked with [specialize]
@kha: I changed the specialization candidate selection procedure.
Now, instances are not considered for specializations unless we mark
them with `[specialize]`. The idea is that an instance application is
morally just creating the "dictionary" for invoking a polymorphic
function.
2018-10-15 18:29:29 -07:00
Leonardo de Moura
4cfe44bed0 feat(library/compiler/specialize): add nospecialize attribute
@kha I had to add this attribute because the specializer was generated
many specialization candidates for functions that take `[has_tokens ...]`
as an argument. Moreover, these candidates had a lot of
dependencies. I am trying to workaround this issue by marking the
instances with the new attribute `[nospecialize]`.
I did not mark instances created by `[derive]`. It is quite tedious to
do it.

BTW, when I was investigating the problem I stumbled at `node.view`.
Its type is:
```
node.view :
  Π {α : Type} {m : Type → Type} [_inst_1 : monad m] [_inst_2 : monad_except (parsec.message syntax) m]
  [_inst_3 : monad_parsec syntax m] [_inst_4 : alternative m] (k : syntax_node_kind) (rs : list (m syntax))
  [i : @has_view syntax_node_kind k α], @has_view (m syntax) (@node m _inst_1 _inst_2 _inst_3 _inst_4 k rs) α
```
This looks wrong: the view depends on `[monad_parsec syntax m]`

We should also make sure definitions do not have unnecessary type
class instances. Otherwise, we will put additional stress on the code
specializer. One option is to change the frontend and filter unused
instances.
2018-10-15 17:44:26 -07:00
Leonardo de Moura
15a25d5aa9 chore(library/init/lean/parser): add a few comments 2018-10-11 15:54:57 -07:00
Sebastian Ullrich
22714b9b10 perf(library/init/lean/parser/combinators): node: no need to fill up with syntax.missing anymore
Views now do iterated pattern matches instead of a single one
2018-10-04 14:27:24 -07:00
Sebastian Ullrich
b443006e8f fix(library/init/lean/parser/syntax): reprint: do not concatenate choice contents 2018-10-01 09:02:39 -07:00
Sebastian Ullrich
203545ce99 chore(library/init/lean/parser/trie): add debug print
Also make sure it's in the prelude, whoops
2018-09-28 13:08:24 -07:00
Sebastian Ullrich
e661aaeacf refactor(library/init/lean/parser): store registered parsers in configs, use config hierarchy to avoid mutually recursive types
And other refactorings along the way
2018-09-27 10:05:10 -07:00
Sebastian Ullrich
32f4d52e1c refactor(library/init/lean): revert introduction of tysyntax; push syntax.missing through views 2018-09-24 18:24:27 -07:00
Sebastian Ullrich
ed0a8a8827 feat(library/init/lean/parser/combinators): make optional's view default to none 2018-09-24 09:53:28 -07:00
Sebastian Ullrich
41c0bc87fd refactor(library/init/lean/parser): make views shallow via tysyntax 2018-09-22 21:24:38 -07:00
Sebastian Ullrich
64a5d0f240 refactor(library/init/lean/parser): has_tokens default 2018-09-20 09:38:10 -07:00
Sebastian Ullrich
c7c459d47b Revert "perf(library/init/lean/parser): collect tokens in trie instead of list, do not inline"
This reverts commit e4c50b2b09.

Lists are efficient enough and make it easier to customize the trie construction.

Keep the `donotinline` though.
2018-09-20 09:38:10 -07:00
Sebastian Ullrich
e4c50b2b09 perf(library/init/lean/parser): collect tokens in trie instead of list, do not inline 2018-09-19 12:36:34 -07:00
Sebastian Ullrich
fa0148e5b8 feat(library/init/lean/parser): declarations and binders 2018-09-17 18:47:50 -07:00
Sebastian Ullrich
6b28162eee chore(library/init/lean/parser/combinators): move out combinators 2018-09-17 18:47:50 -07:00