Sebastian Ullrich
e5aaf391ff
fix(library/init/lean/parser/syntax): macro_scopes.flip
2018-12-19 15:04:48 +01:00
Sebastian Ullrich
5b44a6f93d
feat(library/init/lean/parser/parsec): structured doc_comment syntax nodes
2018-12-19 14:42:33 +01:00
Sebastian Ullrich
0cf88598d2
feat(library/init/lean/parser/declaration): stricter grammar for universe parameters and non-optional declaration types
2018-12-19 14:41:17 +01:00
Sebastian Ullrich
4f7be93e87
feat(library/init/lean): remove support for section aliases
2018-12-18 17:04:04 +01:00
Sebastian Ullrich
0a63d39247
refactor(library/init/lean): syntax.mk_app'/mk_app ~> syntax.mk_app/mk_capp
2018-12-14 17:37:37 +01:00
Sebastian Ullrich
306da89551
feat(library/init/lean/expander): expand universe( variable)s to multiple universe( variable) commands
2018-12-07 10:31:14 +01:00
Sebastian Ullrich
e7a6746b6a
refactor(library/init/lean): share error function between expander and elaborator
2018-12-06 17:03:01 +01:00
Sebastian Ullrich
9c9e642210
feat(library/init/lean/elaborator): universe operators, subtype
2018-12-06 13:23:12 +01:00
Sebastian Ullrich
4b3995fac3
refactor(library/init/lean/parser/term): factor out opt_type parser
2018-12-06 13:23:12 +01:00
Sebastian Ullrich
143ac0e58a
feat(library/init/lean/expander): also normalize bracketed binders in e.g. declarations
2018-12-06 13:23:12 +01:00
Sebastian Ullrich
79b7a29d3f
fix(library/init/lean/parser/syntax): syntax.to_format: reverse scope stack
2018-12-04 13:44:46 +01:00
Sebastian Ullrich
ad27da3209
perf(library/init/lean/parser/syntax): optimize syntax.flip_scopes
2018-12-04 13:16:45 +01:00
Sebastian Ullrich
c3f8e219c0
feat(library/init/lean/expander): preresolve global references (not actually used anywhere yet)
2018-11-27 18:02:51 +01:00
Sebastian Ullrich
d9dc4edd31
refactor(library/init/lean/parser/combinators): improve sep_by view
2018-11-27 17:11:14 +01:00
Sebastian Ullrich
ee9c26947c
feat(library/init/lean/elaborator): structure instances
2018-11-22 17:28:19 +01:00
Sebastian Ullrich
32e3e8a336
feat(library/init/lean/elaborator): sort_app, explicit
2018-11-21 18:13:38 +01:00
Sebastian Ullrich
cc93a2eb89
feat(library/init/lean/expander): extend "simple binders" to pi, expand pi
2018-11-21 18:13:38 +01:00
Sebastian Ullrich
a4b9cc83b8
feat(library/init/lean/{expander,elaborator}): progress
2018-11-21 18:13:38 +01:00
Sebastian Ullrich
222fff8862
refactor(library/init/lean/elaborator): introduce simple lambda binder
2018-11-21 18:13:38 +01:00
Sebastian Ullrich
c8eaee74b4
feat(frontends/lean,library/init/lean/parser/combinators): add node_longest_choice! macro
2018-11-19 18:02:28 +01:00
Sebastian Ullrich
d10ff29bea
fix(library/init/lean/parser/term): placeholder binder after bracketed binder
2018-11-19 13:38:45 +01:00
Sebastian Ullrich
cd287629cb
feat(library/init/lean/elaborator): initial version of translating syntax trees to preterms
2018-11-19 13:38:45 +01:00
Sebastian Ullrich
9e8dfbad79
perf(library/init/lean/parser): reintroduce separate syntax.ident constructor with much simpler and more efficient encoding
2018-11-18 16:55:04 +01:00
Sebastian Ullrich
68dad5e77c
chore(library/init/lean/parser/token): raw: unnecessary try
2018-11-18 16:11:41 +01:00
Leonardo de Moura
7937f1e010
chore(library/init/util): remove util.lean
...
At least initially, we will not support these primitives in the new compiler.
2018-11-15 16:27:52 -08:00
Sebastian Ullrich
600b7ceb28
fix(library/init/lean/parser/syntax): make sure macro scopes are not pushed inside of ident nodes
2018-11-14 17:23:32 +01:00
Leonardo de Moura
182812a278
chore(library/init/lean/parser/token): make sure generate code does contain partially applied reader_t.or_else and reader_t.bind
...
@kha This one was crazy, the compiler created a join point for the
continuation of the match-expression. Each case of the match was
invoking the join point with a different parser. Two of the branches
were the partially applied `reader_t.bind` and `reader_t.orelse`.
This change did not improve the performance much, but it makes sure we
don't waste time trying to figure out why we have these two partial
applications in the call graph.
2018-11-08 17:39:46 -08:00
Leonardo de Moura
6eca6bdb0e
perf(library/init/lean/parser/term): avoid eta-expansion issues
...
cc @kha
2018-11-08 16:21:37 -08:00
Leonardo de Moura
1cb22b6801
perf(library/init/lean/parser/command): move common command parsers to the beginning of the list
...
@kha This modification saved 150k object allocations on my machine.
BTW, the function
```
def command_parser.run (commands : list command_parser) (p : command_parser)
: parser_t command_parser_config id syntax :=
λ cfg, (p.run cfg).run_parsec $ λ _, any_of $ commands.map (λ p, p.run cfg)
```
is also affected by the problem I described at Zulip. It is another
example where eager eta-expansion is bad. Every time we call it, we
will create approx. 20 closures and 20 cons memory cells. We have at
least 600 commands in core.lean. So, just the `map` nested there will
generate 24k memory allocations. Moreover, the problem will get worse as we add
more commands.
2018-11-08 14:45:34 -08:00
Leonardo de Moura
ad9aa3bc19
perf(library/init/lean/parser/token): optimize symbol
...
Same trick used at `str`.
@kha: I also replaced `"token " ++ sym'` with `sym'`. We were creating
thousands of strings of the form "token ...".
2018-11-08 14:05:09 -08:00
Leonardo de Moura
0dfeb8a79c
perf(library/init/lean/parser/parsec): optimize str and raw_str
...
Both `str` amd `raw_str` are used with string literals. This commit
makes sure we don't need to recompute the nested term
`dlist.singleton (repr s)`. This modification saves .2 secs when
parsing `core.lean` on my MacBook.
cc @kha
2018-11-08 11:18:21 -08:00
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
d77c6169f4
chore(library/init/lean/parser/combinators): node: small simplification
2018-11-08 10:43:17 +01:00
Sebastian Ullrich
7fdfdb1784
chore(library/init/lean/parser): remove unnecessary class constraints
2018-11-06 21:45:08 +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
fc4dcd19cf
refactor(library/init/lean/parser): use ident.view in syntax.to_format
2018-11-05 17:57:00 +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
93fc1fd1de
fix(library/init/lean/parser/combinators): node: do not wrap error in first argument
2018-10-30 17:43:05 +01:00
Sebastian Ullrich
74bd182bc8
perf(library/init/lean/parser/combinators): make node semireducible
2018-10-30 17:43:05 +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
188ab30a9c
fix(library/init/lean/parser/declaration): precedence for attribute arguments
2018-10-30 17:43:05 +01:00
Leonardo de Moura
cc3767e6a5
refactor(library/init/data): avoid indirection at rbmap
...
Now, the nodes in a `rbmap` contain the key and value, and we avoid
one level of indirection. `rbmap`s are more common than `rbtree`.
We implement `rbtree A` as `rbmap A unit`.
2018-10-26 17:14:09 -07:00
Leonardo de Moura
96ef30e827
chore(library/init/lean/parser/parsec): remove private
...
Motivation: allow us to change the attribute in other files
2018-10-25 10:55:32 -07:00
Leonardo de Moura
370f67b27b
feat(library/init/lean/parser/parsec): mark *_mk_res functions as [inline_if_reduce]
2018-10-25 10:10:54 -07:00
Sebastian Ullrich
08d8856112
perf(library/init/lean/parser/token): replace longest_match in token with custom implementation
2018-10-22 22:33:58 +02:00
Sebastian Ullrich
163f996d00
perf(library/init/lean/parser): inline some trivial functions
2018-10-22 22:23:54 +02:00
Leonardo de Moura
19be59065a
perf(library/init/lean/parser/parsec): mark bind_mk_res and orelse_mk_res with @[inline]
...
A few weeks ago, it was not feasible to inline `bind_mk_res` and
`orelse_mk_res` because the compilation time would increase a lot.
Since then I have improved the heuristics for deciding whether to float
`cases_on` or not.
So, I tried today to mark them with `@[inline]` again.
The corelib build time increased only 1.2 secs, but the `parser1.lean` runtime improved:
Before:
```
num. allocated objects: 18025367
num. allocated closures: 2988476
```
After:
```
num. allocated objects: 15774515
num. allocated closures: 2488695
```
I used my desktop to collect the numbers above.
2018-10-22 11:11:21 -07:00