Leonardo de Moura
90a79a0b06
chore: remove command universes
...
Now, `universe` may declare many universes. The goal is to make it
consistent with the `variable` command
2021-06-29 17:01:07 -07:00
Leonardo de Moura
71cd067e94
feat: add helper command
2021-05-13 22:10:35 -07:00
Sebastian Ullrich
73cf3533a1
fix: count quotation depth in parser correctly
2021-04-29 13:33:48 +02:00
Sebastian Ullrich
8119daeb18
feat: syntax & attribute for double-quoted quotations
2021-04-27 16:38:37 -07:00
Daniel Selsam
d35091da56
feat: parser alias for 'declVal'
2021-04-12 16:59:54 -07:00
Leonardo de Moura
2fc775954c
fix: error recovery
...
@kha We have a few parsers that invoke `tokenFn`, and return error
depending of what is on the top of the stack (e.g., `ident`).
These parsers were not restoring the stack size when reporting errord,
and messing up the error recovery. We never notice the problem because
operators such as <|> restore the stack size, and we were not trying
to elaborate syntacticly incorrect terms.
2021-03-31 17:05:34 -07:00
Leonardo de Moura
c35f96ac82
feat: avoid bizarre error message for definition without body
...
@kha This is a temporary hack to avoid a incomprehensible error
message. I will try to tweak the parser error recovery in another
commit.
2021-03-31 17:05:34 -07:00
Leonardo de Moura
164577d94e
chore: remove parser! and tparser!
...
The new macros are called "leading_parser` and `trailing_parser`.
cc @Kha
2021-03-11 09:36:58 -08:00
Leonardo de Moura
b3d83aa199
feat: set_option parser for terms and tactics
2021-03-06 15:38:02 -08:00
Leonardo de Moura
4bcfc5f9a6
feat: open parser for terms and tactics
2021-03-06 15:32:59 -08:00
Leonardo de Moura
960e964b71
feat: allow user to "erase" [simp] lemmas
2021-03-04 11:36:12 -08:00
Sebastian Ullrich
8a02dfec4f
feat: subsume variables under variable
...
/cc @leodemoura
2021-01-22 14:36:05 +01:00
Leonardo de Moura
308c61027a
feat: save doc strings
...
We can now document `let rec` too.
2021-01-10 07:13:33 -08:00
Leonardo de Moura
e74ba14f4c
feat: modify structSimpleBinder parser
...
@Kha It felt odd that we can write
```
map f x := ...
```
in instances, but we had to write
```
map (f x) := ...
```
when setting the field default value in a class.
2020-12-23 08:23:14 -08:00
Leonardo de Moura
4fc06bfcca
feat: add optional (priority := <prio>) to instance command
2020-12-21 10:02:12 -08:00
Leonardo de Moura
c7a8fa2629
chore: expose a few auxiliary command parsers
2020-12-14 09:15:26 -08:00
Leonardo de Moura
0862df9ade
fix: missing ppSpace at set_option parser
2020-12-13 15:52:03 -08:00
Leonardo de Moura
8fd6870931
fix: optDeriving parser
2020-12-12 18:58:44 -08:00
Leonardo de Moura
01ec581617
chore: update deriving instance syntax
2020-12-12 16:48:12 -08:00
Leonardo de Moura
3743f877f4
feat: add deriving parsers
2020-12-12 15:33:36 -08:00
Leonardo de Moura
76fb1799fe
chore: goodies for deriving command
2020-12-11 18:08:50 -08:00
Leonardo de Moura
1c0943ad82
feat: add #reduce command parser
2020-12-06 09:32:25 -08:00
Leonardo de Moura
fdc2c9f281
feat: process local instance ... and scoped instance ... commands
2020-12-05 15:46:25 -08:00
Leonardo de Moura
d27770ea0e
chore: prepare to add scoped and local instances
2020-12-05 15:36:23 -08:00
Leonardo de Moura
10102bf370
chore: remove "local" before attribute command
...
`local` is now part of the `Term.attrInstance` parser.
2020-12-05 07:47:28 -08:00
Leonardo de Moura
c476954eef
feat: heterogeneous OrElse and AndThen
...
@Kha I had a few issues similar to the `Append` issues.
We used a similar idiom for writing builtin parsers where we may write
```
def p : Parser := "foo " >> "bla "
```
as a shorthand for
```
def p : Parser := symbol "foo " >> symbol "bla "
```
I want to support `builtin syntax` one day :)
That being said, we should decide whether we keep `HAppend`, `HOrElse`,
and `HAndThen` or not.
The only one I wish I had in the past is `HAndThen`.
2020-12-01 18:32:24 -08:00
Leonardo de Moura
5585f9823f
chore: cleaner structure/class syntax
...
@Kha I implemented the syntax for structure/class that we discussed this morning.
It is much cleaner. See new tests at `struct2.lean`.
I updated the documentation to use it.
2020-11-24 13:07:43 -08:00
Leonardo de Moura
5884b9c19a
feat: add support for instance ... where
...
@Kha The fields are not mutually recursive yet, but it is good enough
for writing examples in the manual.
See new test
2020-11-23 18:07:02 -08:00
Leonardo de Moura
ac85650e0a
feat: add optional where clause at declarations
...
closes #191
@Kha Note that it expands into a "let rec".
There are many other places where an optional `where`-clause is
useful. We can add them later. It is relatively easy to add support in
other places using the new helper functions
`expandWhereDeclsOpt` and `expandMatchAltsWhereDecls`
2020-11-23 12:04:51 -08:00
Leonardo de Moura
3f27d7318e
chore: prepare to add where clause to declarations
2020-11-23 10:41:12 -08:00
Leonardo de Moura
0fcf6217ec
feat: optional := before constructors in the inductive command
...
@Kha In the documentation, I will always use `:=`. The idea is to
avoid the issue: why does `structure` have a `:=` but `inductive`
doesn't.
2020-11-19 06:43:14 -08:00
Leonardo de Moura
360fa1638f
chore: rename Parser.try to Parser.atomic
...
Reason: `try` is a keyword.
cc @Kha
2020-11-17 08:25:01 -08:00
Leonardo de Moura
61dfe2b1db
fix: letDecl
...
use `simpleBinderWithoutType` at `declSig` and `optDeclSig`
2020-11-12 16:22:57 -08:00
Sebastian Ullrich
bc8cb5edda
feat: pretty printer: adapt new indentation style
2020-10-30 19:08:39 +01:00
Leonardo de Moura
13c2a8ff51
chore: remove #lang lean4 header
2020-10-25 09:54:07 -07:00
Leonardo de Moura
6ca1768957
fix: optional := in the structure command
2020-10-22 04:39:20 -07:00
Leonardo de Moura
24d41b9518
chore: move to new frontend
2020-10-21 12:16:30 -07:00
Leonardo de Moura
52e676af83
feat: add builtin_initialize command
2020-10-19 15:02:42 -07:00
Leonardo de Moura
60e4f4fee1
feat: improve notFollowedBy error messages
2020-10-15 17:01:10 -07:00
Sebastian Ullrich
78ffc72150
chore: remove ppGroups beneficial only for group but not fill
2020-10-14 14:24:47 +02:00
Leonardo de Moura
77ce42548b
fix: add nonReservedSymbol
2020-10-13 12:52:18 -07:00
Leonardo de Moura
63edecf106
feat: expand initialize macro
2020-10-10 08:23:49 -07:00
Leonardo de Moura
698c3db655
chore: take doSeq at initialize
2020-10-10 07:41:44 -07:00
Sebastian Ullrich
064c9b2e0b
chore: binder spacing
2020-10-07 09:46:47 +02:00
Sebastian Ullrich
21f1a66ceb
feat: add & use ppDedent parser combinator
2020-10-07 09:46:47 +02:00
Sebastian Ullrich
88164a5e91
feat: more pp tweaks
2020-10-07 09:44:05 +02:00
Sebastian Ullrich
5d76a981b0
chore: adjust pp spacing
2020-10-07 09:44:04 +02:00
Sebastian Ullrich
bdff53fdf5
feat: use ppLine
2020-10-07 09:43:05 +02:00
Leonardo de Moura
3d6cc2de08
feat: add notFollowedByCategoryToken parser
2020-09-26 15:53:23 -07:00
Leonardo de Moura
2d8506b7c6
feat: add doElem parser category
2020-09-26 06:18:44 -07:00