Commit graph

846 commits

Author SHA1 Message Date
Leonardo de Moura
6a740723a4 chore(frontends/lean): remove node! and nodeChoice! macros
They were used in the parsing framework based on `Parsec`
2019-06-24 15:48:11 -07:00
Leonardo de Moura
00aa2a3ffe chore(library/user_recursors): remove [recursor] attribute and environment extension 2019-06-20 11:25:53 -07:00
Leonardo de Moura
9310c807e6 feat(library/private): use environment extension in Lean
Remark: we don't need the `m_inv_map` anymore.
2019-06-03 11:50:33 -07:00
Leonardo de Moura
9d9f546ad8 refactor(util/sexpr): move options and option_declarations to util 2019-05-16 14:37:24 -07:00
Leonardo de Moura
31d4fa9f71 chore(util/sexpr/options): shrink options API
Motivation: move to the Lean implementation
2019-05-16 14:08:11 -07:00
Leonardo de Moura
0d1a0c8b6e chore(library): toBool ==> decide
We want to define a type class similar to Haskell's `ToBool`.
2019-05-06 14:02:15 -07:00
Leonardo de Moura
cd21793b53 fix(frontends/lean/elaborator): assertion violation
Prevent assertion violation when processing examples such as:
```
@[pattern] def badPattern (x : Nat) : Nat := 0

def tst (y : Nat) : Nat :=
match y with
| (@badPattern _) := 1
| _               := 2
```

The `x` is not used in `badPattern`. Thus, the elaborator fails to
synthesize the metavariable corresponding to `_` at `@badPattern _`.

The fix detects this kind of instance, but I commented the code the
throws the error because we would prevent us from compiling `term.lean`.
The assertion violation was originally triggered by the pattern definition
```
@[pattern] def «explicitBinderContent» (requireType : optParam.{1} Bool Bool.false) :=
  {SyntaxNodeKind . name := `Lean.Parser.Term.explicitBinderContent}
at

...
  view := fun stx, let (stx, i) := match stx.asNode : _ -> Prod Syntax Nat with
  | some {kind := @«explicitBinderContent» requireType,   -- << HERE
          args := [stx], ..} := ...
```
These definitions were generated by the node choice macro.

cc @kha
2019-03-27 16:42:59 -07:00
Sebastian Ullrich
2df060be44 feat(frontends/lean/elaborator): node!: support parameterized parsers 2019-03-26 11:21:53 +01:00
Leonardo de Moura
855dab52e0 chore(library/init/Lean): more fixes
`elaborator.lean` is almost working
2019-03-21 15:06:44 -07:00
Leonardo de Moura
5bbc80fdad chore(*): fixed token.lean 2019-03-21 15:06:44 -07:00
Leonardo de Moura
300aae08b3 chore(*): more fixes 2019-03-21 15:06:44 -07:00
Leonardo de Moura
ac27bd092b chore(*): small fixes 2019-03-21 15:06:44 -07:00
Leonardo de Moura
e0b0ca4830 chore(*): adapt C++ code to camelCase 2019-03-21 15:06:43 -07:00
Leonardo de Moura
bc75a24127 chore(library, frontends): use camelCase for attribute names 2019-03-21 15:06:43 -07:00
Leonardo de Moura
039e7fab48 refactor(library): add suffixes.h with commonly used suffixes such as brec_on 2019-03-21 15:06:43 -07:00
Leonardo de Moura
9675b7c952 fix(frontends/lean/elaborator): ignore mdata when processing field notation 2019-02-11 17:29:38 -08:00
Sebastian Ullrich
789252ad2b chore(frontends/lean/elaborator): show traces from node! 2019-02-07 14:16:28 +01:00
Sebastian Ullrich
da865fc33a refactor(frontends/lean/{vm_,}elaborator): move name resolution over to parser locals
In the end I wasn't quite sure whether this is necessary, but it's at least simpler.
2019-01-12 14:14:22 +01:00
Sebastian Ullrich
807b460e9c feat(*/elaborator): pass preresolved names to C++ as annotations and use them for global name resolution
With actual preresolution still missing, the only preresolved names so far are
ones like `opt_param` from built-in macros that have been preresolved manually
(and which weren't successfully resolved before this commit because of the macro
scopes applied to them)
2019-01-01 23:59:23 +01:00
Sebastian Ullrich
8753491cb5 chore(library/placeholder): remove obsolete level one_placeholder
Remnant of the previous Type/Sort approach
2018-12-21 15:52:56 +01:00
Sebastian Ullrich
db6b1d6e85 feat(frontends/lean/vm_elaborator,library/init/lean/elaborator): pass parser_state between languages, create parser object on C++ side to existing functions (that don't actually parse anything) 2018-12-18 15:30:38 +01:00
Sebastian Ullrich
4e96f092f9 feat(library/init/lean/elaborator): delegate elaboration of attribute 2018-12-14 17:38:19 +01:00
Sebastian Ullrich
d9a22d43b2 feat(library/vm/vm_aux): add primitive for calling old elaborator 2018-12-14 17:36:56 +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
7d7d15f8f7 chore(frontends/lean/elaborator): improve error positions 2018-11-19 15:28:23 +01:00
Sebastian Ullrich
2f8e6cc975 chore(frontends/lean/elaborator,library/compiler/compiler): avoid error recovery errors 2018-11-14 09:52:22 +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
09aa4f9ab3 chore(frontends/lean/elaborator): don't try to recover from errors in patterns 2018-11-04 19:03:00 +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
8a3e7821d7 fix(frontends/lean/elaborator): weaken assertion
There are still some cases like errors in nested equations that leak
metavariables, but as long as we report at least one error, that probably isn't
a high-priority issue.
2018-10-30 17:43:05 +01:00
Leonardo de Moura
9256618d67 chore(library/vm): remove vm_name 2018-10-23 11:32:56 -07:00
Leonardo de Moura
5d726eb210 feat(library/compiler/compiler): switch to new compiler frontend
We also rename `vm_compiler` module to `emit_bytecode`.
We will eventually replace this module with the new IR emitter.
2018-10-08 17:38:17 -07:00
Leonardo de Moura
e75d8eacb6 fix(frontends/lean/elaborator): compilation erros with g++ 4.9 2018-10-08 11:54:28 -07:00
Sebastian Ullrich
305984bab5 feat(frontends/lean/elaborator): show context of unassigned mvars 2018-10-08 09:32:41 -07:00
Sebastian Ullrich
50e6b42f8c fix(frontends/lean/elaborator): ensure_no_unassigned_metavars: only check mvars in parameter
Had forgotten to re-check the standard lib...
2018-10-07 21:11:02 -07:00
Sebastian Ullrich
aea86eb828 feat(frontends/lean/elaborator): simple, accurate mvar error position tracking
The accuracy of `m_last_pos` still needs to be improved at some point
2018-10-05 21:25:39 -07:00
Sebastian Ullrich
c50b89a318 fix(frontends/lean/elaborator): node!/node_choice!: use constant options for printing-parsing 2018-10-04 14:27:24 -07:00
Sebastian Ullrich
25b9deab15 fix(frontends/lean/elaborator): fix try_monad_coercion 2018-10-02 14:55:28 -07:00
Leonardo de Moura
990fbe3c30 feat(library/compiler): provide options to vm_compile 2018-09-30 08:50:40 -07:00
Sebastian Ullrich
6cbb77c068 fix(frontends/lean/elaborator): node!: fix view code of try block 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
18cf4d50bb chore(frontends/lean/elaborator): ignore error caused by synthetic sorry 2018-09-25 16:48:01 -07:00
Sebastian Ullrich
90984a63e8 chore(frontends/lean/elaborator): improve application error positions 2018-09-25 16:08:57 -07:00
Sebastian Ullrich
11259b62d2 chore(frontends/lean/elaborator): try to make error positions a bit more accurate 2018-09-25 14:48:57 -07:00
Sebastian Ullrich
f29a866cb4 perf(frontends/lean/elaborator): do not inline views for now 2018-09-24 18:24:27 -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
aac3627ce1 fix(frontends/lean/elaborator): restore better field notation error message 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