Commit graph

48 commits

Author SHA1 Message Date
Sebastian Ullrich
eaeb0a40a5 chore(library/init/lean/parser): do not expose the parser cache as monad_state 2018-11-08 16:01:19 +01:00
Sebastian Ullrich
bd70dc1fc9 perf(library/init/lean/parser): move backtrackable state from parser_core_t to module_parser_m 2018-11-08 15:58:41 +01:00
Sebastian Ullrich
41f4a34d4b feat(library/init/lean/parser/token): cache hit statistics 2018-11-08 14:52:54 +01:00
Sebastian Ullrich
090c4c0ce7 feat(library/init/lean/syntax): add lazily propagated macro scopes to syntax_node 2018-11-06 16:46:50 +01:00
Sebastian Ullrich
8c27f0aac6 refactor(frontends/lean/elaborator,library/init/lean): finish no_kind refactoring 2018-11-04 20:24:40 +01:00
Sebastian Ullrich
0d7ea62f9a perf(frontends/lean/elaborator,library/init/lean): put out_params first to benefit from instance pre-filtering 2018-10-30 17:43:05 +01:00
Sebastian Ullrich
2e0d6649be perf(library/init/lean/parser/basic): make basic_parser_m semireducible 2018-10-30 17:43:05 +01:00
Sebastian Ullrich
163f996d00 perf(library/init/lean/parser): inline some trivial functions 2018-10-22 22:23:54 +02:00
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
880137f0ed feat(library/init/lean/parser/basic): mark tokens with @[nospecialize] 2018-10-18 15:20:54 -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
Sebastian Ullrich
a820b9955f perf(library/init/lean/parser/term): index term parsers by leading token
66% speedup on core.lean
2018-10-15 10:21:08 +02:00
Leonardo de Moura
15a25d5aa9 chore(library/init/lean/parser): add a few comments 2018-10-11 15:54:57 -07:00
Sebastian Ullrich
ebeec844af perf(library/init/lean/parser): minor performance tweaks 2018-10-05 08:52:04 -07:00
Sebastian Ullrich
ca8e75be9e fix(library/init/lean/elaborator): check for and consume end of input 2018-10-03 16:00:08 -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
2e5ea16e2f perf(library/init/lean/parser): cache consecutive calls to token at the same position
Parser performance improved by about 33%
2018-09-27 16:08:19 -07:00
Sebastian Ullrich
26c0f36848 doc(library/init/lean/parser/basic): expand comment 2018-09-27 10:16:40 -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
2c07922327 refactor(library/init/lean/parser): minimize parser_state, have the module coroutine take and return parser_config 2018-09-26 13:20:07 -07:00
Sebastian Ullrich
1d01e81de8 refactor(library/init/lean/parser): do not construct final syntax tree independent from intermediate outputs
This makes sure we have a single consistent view of the file
2018-09-25 18:28:53 -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
9a0b1c7a7f feat(library/init/lean/parser/basic): allow views to specify default value used with opt_param when nested in other views 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
d7d968cead feat(library/init/lean/parser/basic): merge explicit and default (0) token precedences 2018-09-20 09:40:21 -07:00
Sebastian Ullrich
6f68a0d1eb feat(library/init/lean/parser/basic): check for conflicting tokens 2018-09-20 09:40:21 -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
e3afe02786 feat(library/init/lean/parser/declaration): doc comments and axioms 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
Sebastian Ullrich
ae7df32428 refactor(library/init/lean/parser/syntax): setting source_info.leading is much easier after parsing 2018-09-14 16:33:04 -07:00
Sebastian Ullrich
b95ba21702 chore(library/init/lean/parser): fix syntax_node_kind names 2018-09-14 16:33:04 -07:00
Sebastian Ullrich
8aa621efb2 refactor(library/init/lean/{syntax,macro}): remove syntax.ident, simply syntax.atom, remove expander prototype 2018-09-14 16:33:04 -07:00
Sebastian Ullrich
5e180cd170 feat(library/init/lean/parser/token): create structure-preserving syntax trees for identifiers
Also generalize `raw_symbol` to `raw`
2018-09-14 16:33:04 -07:00
Sebastian Ullrich
384389c84b refactor(library/init/lean/parser/basic): move out rec_t and trie 2018-09-14 16:33:04 -07:00
Sebastian Ullrich
98e09c274f feat(library/init/lean/parser/{pratt,level}): factor out pratt combinator, implement level parsers 2018-09-13 16:38:40 -07:00
Sebastian Ullrich
af55cb13e7 fix(library/messages,library/init/lean/message): wrap message_log in structure, reverse in the end 2018-09-11 13:55:25 -07:00
Sebastian Ullrich
99ab0e9d67 refactor(library/messages): make an object_ref 2018-09-11 13:55:25 -07:00
Leonardo de Moura
0691d43153 feat(library/init/lean/parser/basic): define trie using rbnode (char × trie) nested inductice type 2018-09-09 18:19:28 -07:00
Sebastian Ullrich
0d865b37dd feat(library/init/lean/{message,parser}): enhance lean.message
Small regression: order of messages flipped, should eventually be sorted by
position
2018-09-08 18:37:58 -07:00
Sebastian Ullrich
c7d8271c84 feat(library/init/lean/parser/token): save lbp in token_config 2018-09-06 17:16:57 -07:00
Sebastian Ullrich
1a53d4444b feat(library/init/lean/parser): parameterize recursive term parser with rbp 2018-09-06 17:16:22 -07:00
Sebastian Ullrich
d4105e1e16 chore(library/init/lean/parser/basic): avoid nesting rbnode in trie
The new two-layer rbnode/list structure is a little faster
2018-09-05 10:37:03 -07:00
Sebastian Ullrich
66ebd5d7d6 feat(library/init/lean/parser): implement new tokenizer using trie
test execution went down from 3.5s to 1.5s
2018-09-04 14:06:43 -07:00
Sebastian Ullrich
93d13ffea3 chore(library/init/lean): lean.parser.reader ~> lean.parser 2018-08-30 16:34:47 -07:00
Renamed from library/init/lean/parser/reader/basic.lean (Browse further)