Leonardo de Moura
4ccc3fef52
chore: move Init.Lean files to Lean package
2020-05-26 15:04:35 -07:00
Leonardo de Moura
bd58048449
chore: { <source> with ... } syntax
2020-05-20 15:08:43 -07:00
Sebastian Ullrich
8f67db0101
refactor: never implicitly ignore monadic results
...
Also change `do e; f` to desugar to `e *> f` so that it is affected as well
2020-04-23 11:09:59 -07:00
Sebastian Ullrich
f39ea47376
chore: brackted ~> bracketed
2020-03-27 10:42:36 +01:00
Leonardo de Moura
81a7cf50d3
feat: make sure #check and #synth do not modify the environment
2020-03-16 15:36:37 -07:00
Leonardo de Moura
9ad67b6535
chore: remove TODO's
2020-03-11 10:09:34 -07:00
Sebastian Ullrich
d460635e2f
refactor: factor out KeyedDeclsAttribute
2020-03-11 08:38:18 -07:00
Leonardo de Moura
ae19d59d28
feat: add elabChoice for CommandElab
2020-02-18 17:18:28 -08:00
Leonardo de Moura
44817b8488
feat: autoParam takes the Name of an auxiliary declaration of type Syntax
...
@Kha The `Name` (tactic name) approach used in Lean3 is not suitable
for Lean4. The issue is that we define tactics using macros, and in
most cases, the user doesn't even know the node id.
2020-02-13 15:09:42 -08:00
Leonardo de Moura
f85678cc25
feat: improve failIfSucceeds
2020-02-12 13:33:40 -08:00
Leonardo de Moura
7cd0e0a7a5
feat: make sure we can see error messages at #check_failure
2020-02-12 12:23:43 -08:00
Leonardo de Moura
98c925ed7e
feat: elaborate #check_failure
2020-02-12 11:55:02 -08:00
Leonardo de Moura
79f30d5c8c
chore: file name convention
2020-02-08 11:21:52 -08:00
Leonardo de Moura
2abfa1bcff
fix: closes #108
2020-02-01 23:17:00 -08:00
Leonardo de Moura
a370eb3167
feat: try macros first at elabCommand
2020-02-01 01:03:35 -08:00
Leonardo de Moura
b332d5e74d
feat: add proper withFreshMacroScope to MacroM
...
This is useful, for example, for users that want to write recursive
procedural macros.
2020-02-01 00:12:13 -08:00
Leonardo de Moura
aa045f3b07
feat: safer mkCIdentFrom
...
cc @Kha
2020-01-24 17:23:21 -08:00
Leonardo de Moura
ed6cb007d0
refactor: ExtractMacroScopesResult => MacroScopesView, add MacroScopesView.review
2020-01-23 14:11:32 -08:00
Leonardo de Moura
c309f1dccd
chore: remove unnecessary field
2020-01-23 13:05:27 -08:00
Leonardo de Moura
e681bd71d9
feat: simplify MacroM
2020-01-23 12:22:33 -08:00
Leonardo de Moura
fab256d4cc
feat: improve macroscope encoding
2020-01-23 11:33:35 -08:00
Leonardo de Moura
87d002bb43
feat: extend MacroM
...
It now has access to `mainModule` and a name generator.
2020-01-23 09:48:37 -08:00
Leonardo de Moura
ae84270226
feat: include result of sequence of macro expansions
...
@Kha I added this feature to help debugging macros.
I was using `set_option trace.Elab true` as a workaround, but it is
too verbose.
For example, in the following buggy code
```
new_frontend
macro "foo" x:term : term => `(x + 1)
macro "bla" x:term : term => `(foo $x)
```
We get the error message
```
<input>:6:11: error: unknown identifier 'x.15'
with resulting expansion
x + 1
while expanding
foo 1
while expanding
bla 1
```
Perhaps we should preserve the macroscopes at "with resulting
expansion". Anyway, I think it is better than the previous error.
```
<input>:6:11: error: unknown identifier 'x.15'
while expanding
foo 1
while expanding
bla 1
```
2020-01-22 16:08:07 -08:00
Leonardo de Moura
49636c531f
feat: add SynthesizeSyntheticMVars.lean
...
Reason: it depends on to include `Tactic.lean`, and `Tactic.lean`
depends on `Term.lean`
2020-01-16 12:58:37 -08:00
Leonardo de Moura
2e68ffb617
fix: missing set s
2020-01-16 11:12:53 -08:00
Leonardo de Moura
4f84f66a8e
fix: elabCommand main loop
2020-01-15 20:53:24 -08:00
Leonardo de Moura
6ff732f698
refactor: move notation comands to Syntax.lean
2020-01-15 20:53:23 -08:00
Leonardo de Moura
ef4f50d6d5
fix: include macroStack and use getBetterRef when reporting IO errors
2020-01-15 20:53:23 -08:00
Leonardo de Moura
8963090142
chore: reduce code duplication
2020-01-15 20:53:23 -08:00
Leonardo de Moura
b9c161b30c
feat: elaborate macro command
2020-01-15 20:53:23 -08:00
Leonardo de Moura
14310f4d5b
chore: improve error message
2020-01-15 20:53:23 -08:00
Leonardo de Moura
2d83d49341
refactor: add Elab/Syntax.lean
2020-01-14 14:22:55 -08:00
Leonardo de Moura
b057f55e52
chore: add missing rules
2020-01-14 14:01:40 -08:00
Sebastian Ullrich
2e5f62d44f
test: parser/macro macros
2020-01-12 10:32:27 -08:00
Sebastian Ullrich
05d216beb0
feat: command elaboration step trace
2020-01-12 10:32:27 -08:00
Sebastian Ullrich
8d021e0cec
fix: fresh macro scope per command
2020-01-12 10:32:27 -08:00
Sebastian Ullrich
437e1b7245
fix: elaboration of macro-generated defs
2020-01-12 10:32:27 -08:00
Sebastian Ullrich
b18e0a3373
feat: support expanding into multiple commands
2020-01-12 10:32:27 -08:00
Simon Hudon
92c8773137
feat: file IO using handles
2020-01-12 08:02:48 -08:00
Leonardo de Moura
6d77aa20aa
feat: catch deep recursion at MetaM, TermElabM and CommandElabM
...
cc @Kha
2020-01-11 15:03:58 -08:00
Leonardo de Moura
82a36fbfe2
feat: declare_syntax_cat without importing Init.Lean
...
cc @Kha
2020-01-11 09:02:50 -08:00
Leonardo de Moura
e817257922
feat: elaborate declare_syntax_cat
...
TODO: `registerParserCategory` uses `registerAttribute` which relies
on the environment having a declaration of type `AttributeImpl`.
This is bad since forces users to import `Init.Lean`.
@Kha The key problem is that we cannot serialize `AttributeImpl`.
I will try to address this issue tomorrow. I am considering different
workarounds.
2020-01-10 21:10:02 -08:00
Leonardo de Moura
48600dbbfc
refactor: registerAttribute ==> registerBuiltinAttribute
2020-01-10 17:08:12 -08:00
Leonardo de Moura
f783115d21
refactor: SyntaxNode => Syntax at TermElab and CommandElab
...
@Kha It is too annoying to write `.val` all over the place. Moreover,
we now have `match_syntax`.
2020-01-10 15:17:58 -08:00
Leonardo de Moura
f73ff914eb
feat: extensible elaboration functions
...
@kha `termParserAttr.lean` has a small example
2020-01-10 15:05:14 -08:00
Leonardo de Moura
2a8e179a64
feat: add #synth command to new frontend
2020-01-09 09:54:45 -08:00
Leonardo de Moura
923bd321ef
chore: remove unnecessary commands
2020-01-09 09:45:07 -08:00
Leonardo de Moura
2ce2610c0a
feat: add compileDecl
...
cc @kha
2020-01-07 16:38:41 -08:00
Leonardo de Moura
a17ae70be7
feat: elaborate set_option
2020-01-07 12:08:00 -08:00
Leonardo de Moura
070682c4e9
feat: add addContext
2020-01-07 11:04:52 -08:00