feat(library/init/lean/elaborator): add Elab monad
This commit is contained in:
parent
267225eca6
commit
eebb8e2e27
9 changed files with 1456 additions and 179 deletions
95
library/init/lean/elaborator/basic.lean
Normal file
95
library/init/lean/elaborator/basic.lean
Normal file
|
|
@ -0,0 +1,95 @@
|
|||
/-
|
||||
Copyright (c) 2019 Microsoft Corporation. All rights reserved.
|
||||
Released under Apache 2.0 license as described in the file LICENSE.
|
||||
Authors: Leonardo de Moura, Sebastian Ullrich
|
||||
-/
|
||||
prelude
|
||||
import init.lean.namegenerator
|
||||
import init.lean.parser.module
|
||||
|
||||
namespace Lean
|
||||
|
||||
structure ElabScope :=
|
||||
(options : Options := {})
|
||||
|
||||
structure ElabState :=
|
||||
(env : Environment)
|
||||
(parser : Parser.ModuleParser)
|
||||
(messages : MessageLog := {})
|
||||
(ngen : NameGenerator := {})
|
||||
(scopes : List ElabScope := [])
|
||||
|
||||
inductive ElabException
|
||||
| io : IO.Error → ElabException
|
||||
| msg : Message → ElabException
|
||||
| other : String → ElabException
|
||||
|
||||
namespace ElabException
|
||||
|
||||
instance : Inhabited ElabException := ⟨other "error"⟩
|
||||
|
||||
end ElabException
|
||||
|
||||
abbrev Elab := EState ElabException ElabState
|
||||
|
||||
abbrev TermElab := Syntax → Elab Expr
|
||||
abbrev CommandElab := Syntax → Elab Unit
|
||||
|
||||
abbrev TermElabTable : Type := SMap SyntaxNodeKind TermElab Name.quickLt
|
||||
abbrev CommandElabTable : Type := SMap SyntaxNodeKind CommandElab Name.quickLt
|
||||
def mkBuiltinTermElabTable : IO (IO.Ref TermElabTable) := IO.mkRef {}
|
||||
def mkBuiltinCommandElabTable : IO (IO.Ref CommandElabTable) := IO.mkRef {}
|
||||
@[init mkBuiltinTermElabTable]
|
||||
constant builtinTermElabTable : IO.Ref TermElabTable := default _
|
||||
@[init mkBuiltinCommandElabTable]
|
||||
constant builtinCommandElabTable : IO.Ref CommandElabTable := default _
|
||||
|
||||
def declareBuiltinTermElab (env : Environment) (kind : Name) (declName : Name) : IO Environment :=
|
||||
pure env
|
||||
/-
|
||||
TODO
|
||||
|
||||
let name := `_regBuiltinTermElab ++ declName;
|
||||
let type := Expr.app (mkConst `IO) (mkConst `Unit);
|
||||
let val := mkCApp addFnName [mkConst refDeclName, toExpr declName, mkConst declName];
|
||||
let decl := Declaration.defnDecl { name := name, lparams := [], type := type, value := val, hints := ReducibilityHints.opaque, isUnsafe := false };
|
||||
match env.addAndCompile {} decl with
|
||||
| none => throw (IO.userError ("failed to emit registration code for builtin parser '" ++ toString declName ++ "'"))
|
||||
| some env => IO.ofExcept (setInitAttr env name)
|
||||
-/
|
||||
|
||||
@[init] def registerBuiltinTermElabAttr : IO Unit :=
|
||||
registerAttribute {
|
||||
name := `builtinTermElab,
|
||||
descr := "Builtin term elaborator",
|
||||
add := fun env declName args persistent => do {
|
||||
unless persistent $ throw (IO.userError ("invalid attribute 'builtinTermElab', must be persistent"));
|
||||
match env.find declName with
|
||||
| none => throw "unknown declaration"
|
||||
| some decl =>
|
||||
match decl.type with
|
||||
| Expr.const `Lean.TermElab _ => declareBuiltinTermElab env `kind declName
|
||||
| _ => throw (IO.userError ("unexpected term elaborator type at '" ++ toString declName ++ "' `TermElab` expected"))
|
||||
},
|
||||
applicationTime := AttributeApplicationTime.afterCompilation
|
||||
}
|
||||
|
||||
namespace Elab
|
||||
|
||||
/- Remark: in an ideal world where performance doesn't matter, we would define `Elab` as
|
||||
```
|
||||
ExceptT ElabException (StateT ElabException IO)
|
||||
```
|
||||
and we would not need unsafe features for implementing `runIO`.
|
||||
We say `Elab` is "morally" built on top of `IO`. -/
|
||||
unsafe def runIOUnsafe {α : Type} (x : IO α) : Elab α :=
|
||||
match unsafeIO x with
|
||||
| Except.ok a => pure a
|
||||
| Except.error e => throw (ElabException.io e)
|
||||
|
||||
@[implementedBy runIOUnsafe]
|
||||
constant runIO {α : Type} (x : IO α) : Elab α := default _
|
||||
|
||||
end Elab
|
||||
|
||||
end Lean
|
||||
|
|
@ -4,4 +4,5 @@ Released under Apache 2.0 license as described in the file LICENSE.
|
|||
Authors: Leonardo de Moura
|
||||
-/
|
||||
prelude
|
||||
import init.lean.elaborator.basic
|
||||
import init.lean.elaborator.elabstrategyattrs
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
add_library (stage0 OBJECT ./init/coe.cpp ./init/control/alternative.cpp ./init/control/applicative.cpp ./init/control/combinators.cpp ./init/control/conditional.cpp ./init/control/default.cpp ./init/control/estate.cpp ./init/control/except.cpp ./init/control/functor.cpp ./init/control/id.cpp ./init/control/lift.cpp ./init/control/monad.cpp ./init/control/monadfail.cpp ./init/control/option.cpp ./init/control/reader.cpp ./init/control/state.cpp ./init/core.cpp ./init/data/array/basic.cpp ./init/data/array/binsearch.cpp ./init/data/array/default.cpp ./init/data/array/qsort.cpp ./init/data/assoclist.cpp ./init/data/basic.cpp ./init/data/bytearray/basic.cpp ./init/data/bytearray/default.cpp ./init/data/char/basic.cpp ./init/data/char/default.cpp ./init/data/default.cpp ./init/data/dlist.cpp ./init/data/fin/basic.cpp ./init/data/fin/default.cpp ./init/data/hashable.cpp ./init/data/hashmap/basic.cpp ./init/data/hashmap/default.cpp ./init/data/int/basic.cpp ./init/data/int/default.cpp ./init/data/list/basic.cpp ./init/data/list/default.cpp ./init/data/list/instances.cpp ./init/data/nat/basic.cpp ./init/data/nat/bitwise.cpp ./init/data/nat/default.cpp ./init/data/nat/div.cpp ./init/data/option/basic.cpp ./init/data/option/instances.cpp ./init/data/ordering/basic.cpp ./init/data/ordering/default.cpp ./init/data/persistentarray/basic.cpp ./init/data/persistentarray/default.cpp ./init/data/random.cpp ./init/data/rbmap/basic.cpp ./init/data/rbmap/default.cpp ./init/data/rbtree/basic.cpp ./init/data/rbtree/default.cpp ./init/data/repr.cpp ./init/data/string/basic.cpp ./init/data/string/default.cpp ./init/data/tostring.cpp ./init/data/uint.cpp ./init/default.cpp ./init/fix.cpp ./init/io.cpp ./init/lean/attributes.cpp ./init/lean/class.cpp ./init/lean/compiler/closedtermcache.cpp ./init/lean/compiler/constfolding.cpp ./init/lean/compiler/default.cpp ./init/lean/compiler/exportattr.cpp ./init/lean/compiler/externattr.cpp ./init/lean/compiler/implementedbyattr.cpp ./init/lean/compiler/initattr.cpp ./init/lean/compiler/inlineattrs.cpp ./init/lean/compiler/ir/basic.cpp ./init/lean/compiler/ir/borrow.cpp ./init/lean/compiler/ir/boxing.cpp ./init/lean/compiler/ir/checker.cpp ./init/lean/compiler/ir/compilerm.cpp ./init/lean/compiler/ir/default.cpp ./init/lean/compiler/ir/elimdead.cpp ./init/lean/compiler/ir/emitcpp.cpp ./init/lean/compiler/ir/emitutil.cpp ./init/lean/compiler/ir/expandresetreuse.cpp ./init/lean/compiler/ir/format.cpp ./init/lean/compiler/ir/freevars.cpp ./init/lean/compiler/ir/livevars.cpp ./init/lean/compiler/ir/normids.cpp ./init/lean/compiler/ir/pushproj.cpp ./init/lean/compiler/ir/rc.cpp ./init/lean/compiler/ir/resetreuse.cpp ./init/lean/compiler/ir/simpcase.cpp ./init/lean/compiler/namemangling.cpp ./init/lean/compiler/specialize.cpp ./init/lean/compiler/util.cpp ./init/lean/declaration.cpp ./init/lean/default.cpp ./init/lean/elaborator/default.cpp ./init/lean/elaborator/elabstrategyattrs.cpp ./init/lean/environment.cpp ./init/lean/eqncompiler/default.cpp ./init/lean/eqncompiler/matchpattern.cpp ./init/lean/evalconst.cpp ./init/lean/expr.cpp ./init/lean/format.cpp ./init/lean/kvmap.cpp ./init/lean/level.cpp ./init/lean/message.cpp ./init/lean/modifiers.cpp ./init/lean/name.cpp ./init/lean/options.cpp ./init/lean/parser/command.cpp ./init/lean/parser/default.cpp ./init/lean/parser/identifier.cpp ./init/lean/parser/level.cpp ./init/lean/parser/module.cpp ./init/lean/parser/parser.cpp ./init/lean/parser/term.cpp ./init/lean/parser/trie.cpp ./init/lean/position.cpp ./init/lean/projfns.cpp ./init/lean/reducibilityattrs.cpp ./init/lean/runtime.cpp ./init/lean/scopes.cpp ./init/lean/smap.cpp ./init/lean/syntax.cpp ./init/lean/toexpr.cpp ./init/lean/trace.cpp ./init/lean/util.cpp ./init/platform.cpp ./init/util.cpp ./init/wf.cpp)
|
||||
add_library (stage0 OBJECT ./init/coe.cpp ./init/control/alternative.cpp ./init/control/applicative.cpp ./init/control/combinators.cpp ./init/control/conditional.cpp ./init/control/default.cpp ./init/control/estate.cpp ./init/control/except.cpp ./init/control/functor.cpp ./init/control/id.cpp ./init/control/lift.cpp ./init/control/monad.cpp ./init/control/monadfail.cpp ./init/control/option.cpp ./init/control/reader.cpp ./init/control/state.cpp ./init/core.cpp ./init/data/array/basic.cpp ./init/data/array/binsearch.cpp ./init/data/array/default.cpp ./init/data/array/qsort.cpp ./init/data/assoclist.cpp ./init/data/basic.cpp ./init/data/bytearray/basic.cpp ./init/data/bytearray/default.cpp ./init/data/char/basic.cpp ./init/data/char/default.cpp ./init/data/default.cpp ./init/data/dlist.cpp ./init/data/fin/basic.cpp ./init/data/fin/default.cpp ./init/data/hashable.cpp ./init/data/hashmap/basic.cpp ./init/data/hashmap/default.cpp ./init/data/int/basic.cpp ./init/data/int/default.cpp ./init/data/list/basic.cpp ./init/data/list/default.cpp ./init/data/list/instances.cpp ./init/data/nat/basic.cpp ./init/data/nat/bitwise.cpp ./init/data/nat/default.cpp ./init/data/nat/div.cpp ./init/data/option/basic.cpp ./init/data/option/instances.cpp ./init/data/ordering/basic.cpp ./init/data/ordering/default.cpp ./init/data/persistentarray/basic.cpp ./init/data/persistentarray/default.cpp ./init/data/random.cpp ./init/data/rbmap/basic.cpp ./init/data/rbmap/default.cpp ./init/data/rbtree/basic.cpp ./init/data/rbtree/default.cpp ./init/data/repr.cpp ./init/data/string/basic.cpp ./init/data/string/default.cpp ./init/data/tostring.cpp ./init/data/uint.cpp ./init/default.cpp ./init/fix.cpp ./init/io.cpp ./init/lean/attributes.cpp ./init/lean/class.cpp ./init/lean/compiler/closedtermcache.cpp ./init/lean/compiler/constfolding.cpp ./init/lean/compiler/default.cpp ./init/lean/compiler/exportattr.cpp ./init/lean/compiler/externattr.cpp ./init/lean/compiler/implementedbyattr.cpp ./init/lean/compiler/initattr.cpp ./init/lean/compiler/inlineattrs.cpp ./init/lean/compiler/ir/basic.cpp ./init/lean/compiler/ir/borrow.cpp ./init/lean/compiler/ir/boxing.cpp ./init/lean/compiler/ir/checker.cpp ./init/lean/compiler/ir/compilerm.cpp ./init/lean/compiler/ir/default.cpp ./init/lean/compiler/ir/elimdead.cpp ./init/lean/compiler/ir/emitcpp.cpp ./init/lean/compiler/ir/emitutil.cpp ./init/lean/compiler/ir/expandresetreuse.cpp ./init/lean/compiler/ir/format.cpp ./init/lean/compiler/ir/freevars.cpp ./init/lean/compiler/ir/livevars.cpp ./init/lean/compiler/ir/normids.cpp ./init/lean/compiler/ir/pushproj.cpp ./init/lean/compiler/ir/rc.cpp ./init/lean/compiler/ir/resetreuse.cpp ./init/lean/compiler/ir/simpcase.cpp ./init/lean/compiler/namemangling.cpp ./init/lean/compiler/specialize.cpp ./init/lean/compiler/util.cpp ./init/lean/declaration.cpp ./init/lean/default.cpp ./init/lean/elaborator/basic.cpp ./init/lean/elaborator/default.cpp ./init/lean/elaborator/elabstrategyattrs.cpp ./init/lean/environment.cpp ./init/lean/eqncompiler/default.cpp ./init/lean/eqncompiler/matchpattern.cpp ./init/lean/evalconst.cpp ./init/lean/expr.cpp ./init/lean/format.cpp ./init/lean/kvmap.cpp ./init/lean/level.cpp ./init/lean/message.cpp ./init/lean/modifiers.cpp ./init/lean/name.cpp ./init/lean/namegenerator.cpp ./init/lean/options.cpp ./init/lean/parser/command.cpp ./init/lean/parser/default.cpp ./init/lean/parser/identifier.cpp ./init/lean/parser/level.cpp ./init/lean/parser/module.cpp ./init/lean/parser/parser.cpp ./init/lean/parser/term.cpp ./init/lean/parser/trie.cpp ./init/lean/position.cpp ./init/lean/projfns.cpp ./init/lean/reducibilityattrs.cpp ./init/lean/runtime.cpp ./init/lean/scopes.cpp ./init/lean/smap.cpp ./init/lean/syntax.cpp ./init/lean/toexpr.cpp ./init/lean/trace.cpp ./init/lean/util.cpp ./init/platform.cpp ./init/util.cpp ./init/wf.cpp)
|
||||
|
|
|
|||
9
src/stage0/init/io.cpp
generated
9
src/stage0/init/io.cpp
generated
|
|
@ -276,10 +276,13 @@ return x_6;
|
|||
}
|
||||
else
|
||||
{
|
||||
obj* x_7;
|
||||
obj* x_7; obj* x_8;
|
||||
x_7 = lean::cnstr_get(x_4, 0);
|
||||
lean::inc(x_7);
|
||||
lean::dec(x_4);
|
||||
x_7 = lean::box(0);
|
||||
return x_7;
|
||||
x_8 = lean::alloc_cnstr(0, 1, 0);
|
||||
lean::cnstr_set(x_8, 0, x_7);
|
||||
return x_8;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
808
src/stage0/init/lean/elaborator/basic.cpp
generated
Normal file
808
src/stage0/init/lean/elaborator/basic.cpp
generated
Normal file
|
|
@ -0,0 +1,808 @@
|
|||
// Lean compiler output
|
||||
// Module: init.lean.elaborator.basic
|
||||
// Imports: init.lean.namegenerator init.lean.parser.module
|
||||
#include "runtime/object.h"
|
||||
#include "runtime/apply.h"
|
||||
typedef lean::object obj; typedef lean::usize usize;
|
||||
typedef lean::uint8 uint8; typedef lean::uint16 uint16;
|
||||
typedef lean::uint32 uint32; typedef lean::uint64 uint64;
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic ignored "-Wunused-parameter"
|
||||
#pragma clang diagnostic ignored "-Wunused-label"
|
||||
#elif defined(__GNUC__) && !defined(__CLANG__)
|
||||
#pragma GCC diagnostic ignored "-Wunused-parameter"
|
||||
#pragma GCC diagnostic ignored "-Wunused-label"
|
||||
#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
|
||||
#endif
|
||||
obj* l_Lean_SMap_empty___at_Lean_mkBuiltinTermElabTable___spec__1___closed__2;
|
||||
extern "C" uint8 lean_name_dec_eq(obj*, obj*);
|
||||
obj* l_Lean_Elab_runIO___rarg(obj*);
|
||||
obj* l_Lean_Elab_runIOUnsafe(obj*);
|
||||
obj* l_Lean_Elab_runIOUnsafe___rarg(obj*, obj*);
|
||||
obj* l_Lean_registerBuiltinTermElabAttr___closed__5;
|
||||
extern obj* l_Lean_AttributeImpl_inhabited___closed__5;
|
||||
obj* l_Lean_Elab_runIO(obj*, obj*);
|
||||
obj* l_Lean_registerBuiltinTermElabAttr___lambda__1(obj*, obj*, obj*, uint8, obj*);
|
||||
obj* l_Lean_registerBuiltinTermElabAttr___lambda__1___closed__1;
|
||||
obj* l_Lean_registerBuiltinTermElabAttr___closed__7;
|
||||
obj* l_Lean_registerBuiltinTermElabAttr___closed__4;
|
||||
obj* l_Lean_registerAttribute(obj*, obj*);
|
||||
obj* l_Lean_Name_toStringWithSep___main(obj*, obj*);
|
||||
extern obj* l_Lean_mkInitAttr___lambda__1___closed__1;
|
||||
extern obj* l_Lean_AttributeImpl_inhabited___closed__4;
|
||||
obj* l_Lean_SMap_empty___at_Lean_mkBuiltinTermElabTable___spec__1;
|
||||
obj* l_Lean_registerBuiltinTermElabAttr___lambda__1___closed__4;
|
||||
obj* l_Lean_SMap_empty___at_Lean_mkBuiltinCommandElabTable___spec__1___closed__2;
|
||||
obj* l_Lean_Elab_runIO___boxed(obj*, obj*);
|
||||
obj* l_Lean_mkBuiltinCommandElabTable(obj*);
|
||||
obj* l_Lean_registerBuiltinTermElabAttr___lambda__1___closed__6;
|
||||
obj* l_Lean_registerBuiltinTermElabAttr(obj*);
|
||||
namespace lean {
|
||||
obj* string_append(obj*, obj*);
|
||||
}
|
||||
obj* l_Lean_SMap_empty___at_Lean_mkBuiltinCommandElabTable___spec__1;
|
||||
extern "C" obj* lean_name_mk_string(obj*, obj*);
|
||||
obj* l_Lean_registerBuiltinTermElabAttr___closed__6;
|
||||
obj* l_Lean_ElabException_Inhabited;
|
||||
obj* l_mkHashMap___at_Lean_mkBuiltinCommandElabTable___spec__2(obj*);
|
||||
obj* l_Lean_mkBuiltinTermElabTable(obj*);
|
||||
obj* l_Lean_registerBuiltinTermElabAttr___lambda__1___closed__7;
|
||||
obj* l_Lean_ElabException_Inhabited___closed__1;
|
||||
obj* l_mkHashMap___at_Lean_mkBuiltinTermElabTable___spec__2(obj*);
|
||||
obj* l_IO_Prim_mkRef(obj*, obj*, obj*);
|
||||
obj* l_Lean_registerBuiltinTermElabAttr___lambda__1___closed__5;
|
||||
obj* l_Lean_ElabException_Inhabited___closed__2;
|
||||
obj* l_Lean_registerTagAttribute___lambda__7___boxed(obj*, obj*, obj*, obj*, obj*);
|
||||
obj* l_Lean_registerBuiltinTermElabAttr___lambda__1___closed__2;
|
||||
obj* l_Lean_registerBuiltinTermElabAttr___lambda__1___closed__3;
|
||||
obj* l_Lean_ConstantInfo_type(obj*);
|
||||
namespace lean {
|
||||
obj* environment_find_core(obj*, obj*);
|
||||
}
|
||||
obj* l_Lean_registerBuiltinTermElabAttr___closed__2;
|
||||
extern obj* l_Lean_Parser_runBuiltinParserUnsafe___closed__2;
|
||||
obj* l_Lean_declareBuiltinTermElab___boxed(obj*, obj*, obj*, obj*);
|
||||
obj* l_Lean_declareBuiltinTermElab(obj*, obj*, obj*, obj*);
|
||||
obj* l_mkHashMapImp___rarg(obj*);
|
||||
obj* l_Lean_registerBuiltinTermElabAttr___closed__1;
|
||||
obj* l_Lean_SMap_empty___at_Lean_mkBuiltinCommandElabTable___spec__1___closed__1;
|
||||
obj* l_Lean_SMap_empty___at_Lean_mkBuiltinTermElabTable___spec__1___closed__1;
|
||||
obj* l_Lean_builtinCommandElabTable;
|
||||
extern obj* l_Lean_nameToExprAux___main___closed__4;
|
||||
extern obj* l_Lean_Name_toString___closed__1;
|
||||
obj* l_Lean_registerBuiltinTermElabAttr___closed__3;
|
||||
obj* l_Lean_registerBuiltinTermElabAttr___lambda__1___boxed(obj*, obj*, obj*, obj*, obj*);
|
||||
obj* l_Lean_builtinTermElabTable;
|
||||
obj* l_Lean_registerTagAttribute___lambda__6___boxed(obj*, obj*, obj*, obj*, obj*);
|
||||
obj* _init_l_Lean_ElabException_Inhabited___closed__1() {
|
||||
_start:
|
||||
{
|
||||
obj* x_1;
|
||||
x_1 = lean::mk_string("error");
|
||||
return x_1;
|
||||
}
|
||||
}
|
||||
obj* _init_l_Lean_ElabException_Inhabited___closed__2() {
|
||||
_start:
|
||||
{
|
||||
obj* x_1; obj* x_2;
|
||||
x_1 = l_Lean_ElabException_Inhabited___closed__1;
|
||||
x_2 = lean::alloc_cnstr(2, 1, 0);
|
||||
lean::cnstr_set(x_2, 0, x_1);
|
||||
return x_2;
|
||||
}
|
||||
}
|
||||
obj* _init_l_Lean_ElabException_Inhabited() {
|
||||
_start:
|
||||
{
|
||||
obj* x_1;
|
||||
x_1 = l_Lean_ElabException_Inhabited___closed__2;
|
||||
return x_1;
|
||||
}
|
||||
}
|
||||
obj* l_mkHashMap___at_Lean_mkBuiltinTermElabTable___spec__2(obj* x_1) {
|
||||
_start:
|
||||
{
|
||||
obj* x_2;
|
||||
x_2 = l_mkHashMapImp___rarg(x_1);
|
||||
return x_2;
|
||||
}
|
||||
}
|
||||
obj* _init_l_Lean_SMap_empty___at_Lean_mkBuiltinTermElabTable___spec__1___closed__1() {
|
||||
_start:
|
||||
{
|
||||
obj* x_1; obj* x_2;
|
||||
x_1 = lean::mk_nat_obj(8u);
|
||||
x_2 = l_mkHashMapImp___rarg(x_1);
|
||||
return x_2;
|
||||
}
|
||||
}
|
||||
obj* _init_l_Lean_SMap_empty___at_Lean_mkBuiltinTermElabTable___spec__1___closed__2() {
|
||||
_start:
|
||||
{
|
||||
obj* x_1; uint8 x_2; obj* x_3; obj* x_4;
|
||||
x_1 = lean::box(0);
|
||||
x_2 = 1;
|
||||
x_3 = l_Lean_SMap_empty___at_Lean_mkBuiltinTermElabTable___spec__1___closed__1;
|
||||
x_4 = lean::alloc_cnstr(0, 2, 1);
|
||||
lean::cnstr_set(x_4, 0, x_3);
|
||||
lean::cnstr_set(x_4, 1, x_1);
|
||||
lean::cnstr_set_scalar(x_4, sizeof(void*)*2, x_2);
|
||||
return x_4;
|
||||
}
|
||||
}
|
||||
obj* _init_l_Lean_SMap_empty___at_Lean_mkBuiltinTermElabTable___spec__1() {
|
||||
_start:
|
||||
{
|
||||
obj* x_1;
|
||||
x_1 = l_Lean_SMap_empty___at_Lean_mkBuiltinTermElabTable___spec__1___closed__2;
|
||||
return x_1;
|
||||
}
|
||||
}
|
||||
obj* l_Lean_mkBuiltinTermElabTable(obj* x_1) {
|
||||
_start:
|
||||
{
|
||||
obj* x_2; obj* x_3;
|
||||
x_2 = l_Lean_SMap_empty___at_Lean_mkBuiltinTermElabTable___spec__1;
|
||||
x_3 = lean::io_mk_ref(x_2, x_1);
|
||||
return x_3;
|
||||
}
|
||||
}
|
||||
obj* l_mkHashMap___at_Lean_mkBuiltinCommandElabTable___spec__2(obj* x_1) {
|
||||
_start:
|
||||
{
|
||||
obj* x_2;
|
||||
x_2 = l_mkHashMapImp___rarg(x_1);
|
||||
return x_2;
|
||||
}
|
||||
}
|
||||
obj* _init_l_Lean_SMap_empty___at_Lean_mkBuiltinCommandElabTable___spec__1___closed__1() {
|
||||
_start:
|
||||
{
|
||||
obj* x_1; obj* x_2;
|
||||
x_1 = lean::mk_nat_obj(8u);
|
||||
x_2 = l_mkHashMapImp___rarg(x_1);
|
||||
return x_2;
|
||||
}
|
||||
}
|
||||
obj* _init_l_Lean_SMap_empty___at_Lean_mkBuiltinCommandElabTable___spec__1___closed__2() {
|
||||
_start:
|
||||
{
|
||||
obj* x_1; uint8 x_2; obj* x_3; obj* x_4;
|
||||
x_1 = lean::box(0);
|
||||
x_2 = 1;
|
||||
x_3 = l_Lean_SMap_empty___at_Lean_mkBuiltinCommandElabTable___spec__1___closed__1;
|
||||
x_4 = lean::alloc_cnstr(0, 2, 1);
|
||||
lean::cnstr_set(x_4, 0, x_3);
|
||||
lean::cnstr_set(x_4, 1, x_1);
|
||||
lean::cnstr_set_scalar(x_4, sizeof(void*)*2, x_2);
|
||||
return x_4;
|
||||
}
|
||||
}
|
||||
obj* _init_l_Lean_SMap_empty___at_Lean_mkBuiltinCommandElabTable___spec__1() {
|
||||
_start:
|
||||
{
|
||||
obj* x_1;
|
||||
x_1 = l_Lean_SMap_empty___at_Lean_mkBuiltinCommandElabTable___spec__1___closed__2;
|
||||
return x_1;
|
||||
}
|
||||
}
|
||||
obj* l_Lean_mkBuiltinCommandElabTable(obj* x_1) {
|
||||
_start:
|
||||
{
|
||||
obj* x_2; obj* x_3;
|
||||
x_2 = l_Lean_SMap_empty___at_Lean_mkBuiltinCommandElabTable___spec__1;
|
||||
x_3 = lean::io_mk_ref(x_2, x_1);
|
||||
return x_3;
|
||||
}
|
||||
}
|
||||
obj* l_Lean_declareBuiltinTermElab(obj* x_1, obj* x_2, obj* x_3, obj* x_4) {
|
||||
_start:
|
||||
{
|
||||
uint8 x_5;
|
||||
x_5 = !lean::is_exclusive(x_4);
|
||||
if (x_5 == 0)
|
||||
{
|
||||
obj* x_6;
|
||||
x_6 = lean::cnstr_get(x_4, 0);
|
||||
lean::dec(x_6);
|
||||
lean::cnstr_set(x_4, 0, x_1);
|
||||
return x_4;
|
||||
}
|
||||
else
|
||||
{
|
||||
obj* x_7; obj* x_8;
|
||||
x_7 = lean::cnstr_get(x_4, 1);
|
||||
lean::inc(x_7);
|
||||
lean::dec(x_4);
|
||||
x_8 = lean::alloc_cnstr(0, 2, 0);
|
||||
lean::cnstr_set(x_8, 0, x_1);
|
||||
lean::cnstr_set(x_8, 1, x_7);
|
||||
return x_8;
|
||||
}
|
||||
}
|
||||
}
|
||||
obj* l_Lean_declareBuiltinTermElab___boxed(obj* x_1, obj* x_2, obj* x_3, obj* x_4) {
|
||||
_start:
|
||||
{
|
||||
obj* x_5;
|
||||
x_5 = l_Lean_declareBuiltinTermElab(x_1, x_2, x_3, x_4);
|
||||
lean::dec(x_3);
|
||||
lean::dec(x_2);
|
||||
return x_5;
|
||||
}
|
||||
}
|
||||
obj* _init_l_Lean_registerBuiltinTermElabAttr___lambda__1___closed__1() {
|
||||
_start:
|
||||
{
|
||||
obj* x_1;
|
||||
x_1 = lean::mk_string("invalid attribute 'builtinTermElab', must be persistent");
|
||||
return x_1;
|
||||
}
|
||||
}
|
||||
obj* _init_l_Lean_registerBuiltinTermElabAttr___lambda__1___closed__2() {
|
||||
_start:
|
||||
{
|
||||
obj* x_1;
|
||||
x_1 = lean::mk_string("unexpected term elaborator type at '");
|
||||
return x_1;
|
||||
}
|
||||
}
|
||||
obj* _init_l_Lean_registerBuiltinTermElabAttr___lambda__1___closed__3() {
|
||||
_start:
|
||||
{
|
||||
obj* x_1;
|
||||
x_1 = lean::mk_string("' `TermElab` expected");
|
||||
return x_1;
|
||||
}
|
||||
}
|
||||
obj* _init_l_Lean_registerBuiltinTermElabAttr___lambda__1___closed__4() {
|
||||
_start:
|
||||
{
|
||||
obj* x_1;
|
||||
x_1 = lean::mk_string("TermElab");
|
||||
return x_1;
|
||||
}
|
||||
}
|
||||
obj* _init_l_Lean_registerBuiltinTermElabAttr___lambda__1___closed__5() {
|
||||
_start:
|
||||
{
|
||||
obj* x_1; obj* x_2; obj* x_3;
|
||||
x_1 = l_Lean_nameToExprAux___main___closed__4;
|
||||
x_2 = l_Lean_registerBuiltinTermElabAttr___lambda__1___closed__4;
|
||||
x_3 = lean_name_mk_string(x_1, x_2);
|
||||
return x_3;
|
||||
}
|
||||
}
|
||||
obj* _init_l_Lean_registerBuiltinTermElabAttr___lambda__1___closed__6() {
|
||||
_start:
|
||||
{
|
||||
obj* x_1;
|
||||
x_1 = lean::mk_string("kind");
|
||||
return x_1;
|
||||
}
|
||||
}
|
||||
obj* _init_l_Lean_registerBuiltinTermElabAttr___lambda__1___closed__7() {
|
||||
_start:
|
||||
{
|
||||
obj* x_1; obj* x_2; obj* x_3;
|
||||
x_1 = lean::box(0);
|
||||
x_2 = l_Lean_registerBuiltinTermElabAttr___lambda__1___closed__6;
|
||||
x_3 = lean_name_mk_string(x_1, x_2);
|
||||
return x_3;
|
||||
}
|
||||
}
|
||||
obj* l_Lean_registerBuiltinTermElabAttr___lambda__1(obj* x_1, obj* x_2, obj* x_3, uint8 x_4, obj* x_5) {
|
||||
_start:
|
||||
{
|
||||
if (x_4 == 0)
|
||||
{
|
||||
uint8 x_6;
|
||||
lean::dec(x_2);
|
||||
lean::dec(x_1);
|
||||
x_6 = !lean::is_exclusive(x_5);
|
||||
if (x_6 == 0)
|
||||
{
|
||||
obj* x_7; obj* x_8;
|
||||
x_7 = lean::cnstr_get(x_5, 0);
|
||||
lean::dec(x_7);
|
||||
x_8 = l_Lean_registerBuiltinTermElabAttr___lambda__1___closed__1;
|
||||
lean::cnstr_set_tag(x_5, 1);
|
||||
lean::cnstr_set(x_5, 0, x_8);
|
||||
return x_5;
|
||||
}
|
||||
else
|
||||
{
|
||||
obj* x_9; obj* x_10; obj* x_11;
|
||||
x_9 = lean::cnstr_get(x_5, 1);
|
||||
lean::inc(x_9);
|
||||
lean::dec(x_5);
|
||||
x_10 = l_Lean_registerBuiltinTermElabAttr___lambda__1___closed__1;
|
||||
x_11 = lean::alloc_cnstr(1, 2, 0);
|
||||
lean::cnstr_set(x_11, 0, x_10);
|
||||
lean::cnstr_set(x_11, 1, x_9);
|
||||
return x_11;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
uint8 x_12;
|
||||
x_12 = !lean::is_exclusive(x_5);
|
||||
if (x_12 == 0)
|
||||
{
|
||||
obj* x_13; obj* x_14; obj* x_15; obj* x_16;
|
||||
x_13 = lean::cnstr_get(x_5, 1);
|
||||
x_14 = lean::cnstr_get(x_5, 0);
|
||||
lean::dec(x_14);
|
||||
x_15 = lean::box(0);
|
||||
lean::inc(x_13);
|
||||
lean::cnstr_set(x_5, 0, x_15);
|
||||
lean::inc(x_2);
|
||||
lean::inc(x_1);
|
||||
x_16 = lean::environment_find_core(x_1, x_2);
|
||||
if (lean::obj_tag(x_16) == 0)
|
||||
{
|
||||
obj* x_17; obj* x_18;
|
||||
lean::dec(x_5);
|
||||
lean::dec(x_2);
|
||||
lean::dec(x_1);
|
||||
x_17 = l_Lean_mkInitAttr___lambda__1___closed__1;
|
||||
x_18 = lean::alloc_cnstr(1, 2, 0);
|
||||
lean::cnstr_set(x_18, 0, x_17);
|
||||
lean::cnstr_set(x_18, 1, x_13);
|
||||
return x_18;
|
||||
}
|
||||
else
|
||||
{
|
||||
obj* x_19; obj* x_20;
|
||||
x_19 = lean::cnstr_get(x_16, 0);
|
||||
lean::inc(x_19);
|
||||
lean::dec(x_16);
|
||||
x_20 = l_Lean_ConstantInfo_type(x_19);
|
||||
lean::dec(x_19);
|
||||
if (lean::obj_tag(x_20) == 4)
|
||||
{
|
||||
obj* x_21; obj* x_22; uint8 x_23;
|
||||
x_21 = lean::cnstr_get(x_20, 0);
|
||||
lean::inc(x_21);
|
||||
lean::dec(x_20);
|
||||
x_22 = l_Lean_registerBuiltinTermElabAttr___lambda__1___closed__5;
|
||||
x_23 = lean_name_dec_eq(x_21, x_22);
|
||||
lean::dec(x_21);
|
||||
if (x_23 == 0)
|
||||
{
|
||||
obj* x_24; obj* x_25; obj* x_26; obj* x_27; obj* x_28; obj* x_29; obj* x_30;
|
||||
lean::dec(x_5);
|
||||
lean::dec(x_1);
|
||||
x_24 = l_Lean_Name_toString___closed__1;
|
||||
x_25 = l_Lean_Name_toStringWithSep___main(x_24, x_2);
|
||||
x_26 = l_Lean_registerBuiltinTermElabAttr___lambda__1___closed__2;
|
||||
x_27 = lean::string_append(x_26, x_25);
|
||||
lean::dec(x_25);
|
||||
x_28 = l_Lean_registerBuiltinTermElabAttr___lambda__1___closed__3;
|
||||
x_29 = lean::string_append(x_27, x_28);
|
||||
x_30 = lean::alloc_cnstr(1, 2, 0);
|
||||
lean::cnstr_set(x_30, 0, x_29);
|
||||
lean::cnstr_set(x_30, 1, x_13);
|
||||
return x_30;
|
||||
}
|
||||
else
|
||||
{
|
||||
obj* x_31; obj* x_32;
|
||||
lean::dec(x_13);
|
||||
x_31 = l_Lean_registerBuiltinTermElabAttr___lambda__1___closed__7;
|
||||
x_32 = l_Lean_declareBuiltinTermElab(x_1, x_31, x_2, x_5);
|
||||
lean::dec(x_2);
|
||||
return x_32;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
obj* x_33; obj* x_34; obj* x_35; obj* x_36; obj* x_37; obj* x_38; obj* x_39;
|
||||
lean::dec(x_20);
|
||||
lean::dec(x_5);
|
||||
lean::dec(x_1);
|
||||
x_33 = l_Lean_Name_toString___closed__1;
|
||||
x_34 = l_Lean_Name_toStringWithSep___main(x_33, x_2);
|
||||
x_35 = l_Lean_registerBuiltinTermElabAttr___lambda__1___closed__2;
|
||||
x_36 = lean::string_append(x_35, x_34);
|
||||
lean::dec(x_34);
|
||||
x_37 = l_Lean_registerBuiltinTermElabAttr___lambda__1___closed__3;
|
||||
x_38 = lean::string_append(x_36, x_37);
|
||||
x_39 = lean::alloc_cnstr(1, 2, 0);
|
||||
lean::cnstr_set(x_39, 0, x_38);
|
||||
lean::cnstr_set(x_39, 1, x_13);
|
||||
return x_39;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
obj* x_40; obj* x_41; obj* x_42; obj* x_43;
|
||||
x_40 = lean::cnstr_get(x_5, 1);
|
||||
lean::inc(x_40);
|
||||
lean::dec(x_5);
|
||||
x_41 = lean::box(0);
|
||||
lean::inc(x_40);
|
||||
x_42 = lean::alloc_cnstr(0, 2, 0);
|
||||
lean::cnstr_set(x_42, 0, x_41);
|
||||
lean::cnstr_set(x_42, 1, x_40);
|
||||
lean::inc(x_2);
|
||||
lean::inc(x_1);
|
||||
x_43 = lean::environment_find_core(x_1, x_2);
|
||||
if (lean::obj_tag(x_43) == 0)
|
||||
{
|
||||
obj* x_44; obj* x_45;
|
||||
lean::dec(x_42);
|
||||
lean::dec(x_2);
|
||||
lean::dec(x_1);
|
||||
x_44 = l_Lean_mkInitAttr___lambda__1___closed__1;
|
||||
x_45 = lean::alloc_cnstr(1, 2, 0);
|
||||
lean::cnstr_set(x_45, 0, x_44);
|
||||
lean::cnstr_set(x_45, 1, x_40);
|
||||
return x_45;
|
||||
}
|
||||
else
|
||||
{
|
||||
obj* x_46; obj* x_47;
|
||||
x_46 = lean::cnstr_get(x_43, 0);
|
||||
lean::inc(x_46);
|
||||
lean::dec(x_43);
|
||||
x_47 = l_Lean_ConstantInfo_type(x_46);
|
||||
lean::dec(x_46);
|
||||
if (lean::obj_tag(x_47) == 4)
|
||||
{
|
||||
obj* x_48; obj* x_49; uint8 x_50;
|
||||
x_48 = lean::cnstr_get(x_47, 0);
|
||||
lean::inc(x_48);
|
||||
lean::dec(x_47);
|
||||
x_49 = l_Lean_registerBuiltinTermElabAttr___lambda__1___closed__5;
|
||||
x_50 = lean_name_dec_eq(x_48, x_49);
|
||||
lean::dec(x_48);
|
||||
if (x_50 == 0)
|
||||
{
|
||||
obj* x_51; obj* x_52; obj* x_53; obj* x_54; obj* x_55; obj* x_56; obj* x_57;
|
||||
lean::dec(x_42);
|
||||
lean::dec(x_1);
|
||||
x_51 = l_Lean_Name_toString___closed__1;
|
||||
x_52 = l_Lean_Name_toStringWithSep___main(x_51, x_2);
|
||||
x_53 = l_Lean_registerBuiltinTermElabAttr___lambda__1___closed__2;
|
||||
x_54 = lean::string_append(x_53, x_52);
|
||||
lean::dec(x_52);
|
||||
x_55 = l_Lean_registerBuiltinTermElabAttr___lambda__1___closed__3;
|
||||
x_56 = lean::string_append(x_54, x_55);
|
||||
x_57 = lean::alloc_cnstr(1, 2, 0);
|
||||
lean::cnstr_set(x_57, 0, x_56);
|
||||
lean::cnstr_set(x_57, 1, x_40);
|
||||
return x_57;
|
||||
}
|
||||
else
|
||||
{
|
||||
obj* x_58; obj* x_59;
|
||||
lean::dec(x_40);
|
||||
x_58 = l_Lean_registerBuiltinTermElabAttr___lambda__1___closed__7;
|
||||
x_59 = l_Lean_declareBuiltinTermElab(x_1, x_58, x_2, x_42);
|
||||
lean::dec(x_2);
|
||||
return x_59;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
obj* x_60; obj* x_61; obj* x_62; obj* x_63; obj* x_64; obj* x_65; obj* x_66;
|
||||
lean::dec(x_47);
|
||||
lean::dec(x_42);
|
||||
lean::dec(x_1);
|
||||
x_60 = l_Lean_Name_toString___closed__1;
|
||||
x_61 = l_Lean_Name_toStringWithSep___main(x_60, x_2);
|
||||
x_62 = l_Lean_registerBuiltinTermElabAttr___lambda__1___closed__2;
|
||||
x_63 = lean::string_append(x_62, x_61);
|
||||
lean::dec(x_61);
|
||||
x_64 = l_Lean_registerBuiltinTermElabAttr___lambda__1___closed__3;
|
||||
x_65 = lean::string_append(x_63, x_64);
|
||||
x_66 = lean::alloc_cnstr(1, 2, 0);
|
||||
lean::cnstr_set(x_66, 0, x_65);
|
||||
lean::cnstr_set(x_66, 1, x_40);
|
||||
return x_66;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
obj* _init_l_Lean_registerBuiltinTermElabAttr___closed__1() {
|
||||
_start:
|
||||
{
|
||||
obj* x_1;
|
||||
x_1 = lean::mk_string("builtinTermElab");
|
||||
return x_1;
|
||||
}
|
||||
}
|
||||
obj* _init_l_Lean_registerBuiltinTermElabAttr___closed__2() {
|
||||
_start:
|
||||
{
|
||||
obj* x_1; obj* x_2; obj* x_3;
|
||||
x_1 = lean::box(0);
|
||||
x_2 = l_Lean_registerBuiltinTermElabAttr___closed__1;
|
||||
x_3 = lean_name_mk_string(x_1, x_2);
|
||||
return x_3;
|
||||
}
|
||||
}
|
||||
obj* _init_l_Lean_registerBuiltinTermElabAttr___closed__3() {
|
||||
_start:
|
||||
{
|
||||
obj* x_1; obj* x_2;
|
||||
x_1 = l_Lean_registerBuiltinTermElabAttr___closed__2;
|
||||
x_2 = lean::alloc_closure(reinterpret_cast<void*>(l_Lean_registerTagAttribute___lambda__6___boxed), 5, 1);
|
||||
lean::closure_set(x_2, 0, x_1);
|
||||
return x_2;
|
||||
}
|
||||
}
|
||||
obj* _init_l_Lean_registerBuiltinTermElabAttr___closed__4() {
|
||||
_start:
|
||||
{
|
||||
obj* x_1; obj* x_2;
|
||||
x_1 = l_Lean_registerBuiltinTermElabAttr___closed__2;
|
||||
x_2 = lean::alloc_closure(reinterpret_cast<void*>(l_Lean_registerTagAttribute___lambda__7___boxed), 5, 1);
|
||||
lean::closure_set(x_2, 0, x_1);
|
||||
return x_2;
|
||||
}
|
||||
}
|
||||
obj* _init_l_Lean_registerBuiltinTermElabAttr___closed__5() {
|
||||
_start:
|
||||
{
|
||||
obj* x_1;
|
||||
x_1 = lean::mk_string("Builtin term elaborator");
|
||||
return x_1;
|
||||
}
|
||||
}
|
||||
obj* _init_l_Lean_registerBuiltinTermElabAttr___closed__6() {
|
||||
_start:
|
||||
{
|
||||
obj* x_1;
|
||||
x_1 = lean::alloc_closure(reinterpret_cast<void*>(l_Lean_registerBuiltinTermElabAttr___lambda__1___boxed), 5, 0);
|
||||
return x_1;
|
||||
}
|
||||
}
|
||||
obj* _init_l_Lean_registerBuiltinTermElabAttr___closed__7() {
|
||||
_start:
|
||||
{
|
||||
obj* x_1; obj* x_2; obj* x_3; obj* x_4; obj* x_5; obj* x_6; obj* x_7; uint8 x_8; obj* x_9;
|
||||
x_1 = l_Lean_registerBuiltinTermElabAttr___closed__2;
|
||||
x_2 = l_Lean_registerBuiltinTermElabAttr___closed__5;
|
||||
x_3 = l_Lean_registerBuiltinTermElabAttr___closed__6;
|
||||
x_4 = l_Lean_registerBuiltinTermElabAttr___closed__3;
|
||||
x_5 = l_Lean_registerBuiltinTermElabAttr___closed__4;
|
||||
x_6 = l_Lean_AttributeImpl_inhabited___closed__4;
|
||||
x_7 = l_Lean_AttributeImpl_inhabited___closed__5;
|
||||
x_8 = 1;
|
||||
x_9 = lean::alloc_cnstr(0, 8, 1);
|
||||
lean::cnstr_set(x_9, 0, x_1);
|
||||
lean::cnstr_set(x_9, 1, x_2);
|
||||
lean::cnstr_set(x_9, 2, x_3);
|
||||
lean::cnstr_set(x_9, 3, x_4);
|
||||
lean::cnstr_set(x_9, 4, x_5);
|
||||
lean::cnstr_set(x_9, 5, x_6);
|
||||
lean::cnstr_set(x_9, 6, x_7);
|
||||
lean::cnstr_set(x_9, 7, x_7);
|
||||
lean::cnstr_set_scalar(x_9, sizeof(void*)*8, x_8);
|
||||
return x_9;
|
||||
}
|
||||
}
|
||||
obj* l_Lean_registerBuiltinTermElabAttr(obj* x_1) {
|
||||
_start:
|
||||
{
|
||||
obj* x_2; obj* x_3;
|
||||
x_2 = l_Lean_registerBuiltinTermElabAttr___closed__7;
|
||||
x_3 = l_Lean_registerAttribute(x_2, x_1);
|
||||
return x_3;
|
||||
}
|
||||
}
|
||||
obj* l_Lean_registerBuiltinTermElabAttr___lambda__1___boxed(obj* x_1, obj* x_2, obj* x_3, obj* x_4, obj* x_5) {
|
||||
_start:
|
||||
{
|
||||
uint8 x_6; obj* x_7;
|
||||
x_6 = lean::unbox(x_4);
|
||||
lean::dec(x_4);
|
||||
x_7 = l_Lean_registerBuiltinTermElabAttr___lambda__1(x_1, x_2, x_3, x_6, x_5);
|
||||
lean::dec(x_3);
|
||||
return x_7;
|
||||
}
|
||||
}
|
||||
obj* l_Lean_Elab_runIOUnsafe___rarg(obj* x_1, obj* x_2) {
|
||||
_start:
|
||||
{
|
||||
obj* x_3; obj* x_4;
|
||||
x_3 = l_Lean_Parser_runBuiltinParserUnsafe___closed__2;
|
||||
x_4 = lean::apply_1(x_1, x_3);
|
||||
if (lean::obj_tag(x_4) == 0)
|
||||
{
|
||||
obj* x_5; uint8 x_6;
|
||||
x_5 = lean::cnstr_get(x_4, 0);
|
||||
lean::inc(x_5);
|
||||
lean::dec(x_4);
|
||||
x_6 = !lean::is_exclusive(x_2);
|
||||
if (x_6 == 0)
|
||||
{
|
||||
obj* x_7;
|
||||
x_7 = lean::cnstr_get(x_2, 0);
|
||||
lean::dec(x_7);
|
||||
lean::cnstr_set(x_2, 0, x_5);
|
||||
return x_2;
|
||||
}
|
||||
else
|
||||
{
|
||||
obj* x_8; obj* x_9;
|
||||
x_8 = lean::cnstr_get(x_2, 1);
|
||||
lean::inc(x_8);
|
||||
lean::dec(x_2);
|
||||
x_9 = lean::alloc_cnstr(0, 2, 0);
|
||||
lean::cnstr_set(x_9, 0, x_5);
|
||||
lean::cnstr_set(x_9, 1, x_8);
|
||||
return x_9;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
obj* x_10; uint8 x_11;
|
||||
x_10 = lean::cnstr_get(x_4, 0);
|
||||
lean::inc(x_10);
|
||||
lean::dec(x_4);
|
||||
x_11 = !lean::is_exclusive(x_2);
|
||||
if (x_11 == 0)
|
||||
{
|
||||
obj* x_12; obj* x_13;
|
||||
x_12 = lean::cnstr_get(x_2, 0);
|
||||
lean::dec(x_12);
|
||||
x_13 = lean::alloc_cnstr(0, 1, 0);
|
||||
lean::cnstr_set(x_13, 0, x_10);
|
||||
lean::cnstr_set_tag(x_2, 1);
|
||||
lean::cnstr_set(x_2, 0, x_13);
|
||||
return x_2;
|
||||
}
|
||||
else
|
||||
{
|
||||
obj* x_14; obj* x_15; obj* x_16;
|
||||
x_14 = lean::cnstr_get(x_2, 1);
|
||||
lean::inc(x_14);
|
||||
lean::dec(x_2);
|
||||
x_15 = lean::alloc_cnstr(0, 1, 0);
|
||||
lean::cnstr_set(x_15, 0, x_10);
|
||||
x_16 = lean::alloc_cnstr(1, 2, 0);
|
||||
lean::cnstr_set(x_16, 0, x_15);
|
||||
lean::cnstr_set(x_16, 1, x_14);
|
||||
return x_16;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
obj* l_Lean_Elab_runIOUnsafe(obj* x_1) {
|
||||
_start:
|
||||
{
|
||||
obj* x_2;
|
||||
x_2 = lean::alloc_closure(reinterpret_cast<void*>(l_Lean_Elab_runIOUnsafe___rarg), 2, 0);
|
||||
return x_2;
|
||||
}
|
||||
}
|
||||
obj* l_Lean_Elab_runIO___rarg(obj* x_1) {
|
||||
_start:
|
||||
{
|
||||
uint8 x_2;
|
||||
x_2 = !lean::is_exclusive(x_1);
|
||||
if (x_2 == 0)
|
||||
{
|
||||
obj* x_3; obj* x_4;
|
||||
x_3 = lean::cnstr_get(x_1, 0);
|
||||
lean::dec(x_3);
|
||||
x_4 = l_Lean_ElabException_Inhabited___closed__2;
|
||||
lean::cnstr_set_tag(x_1, 1);
|
||||
lean::cnstr_set(x_1, 0, x_4);
|
||||
return x_1;
|
||||
}
|
||||
else
|
||||
{
|
||||
obj* x_5; obj* x_6; obj* x_7;
|
||||
x_5 = lean::cnstr_get(x_1, 1);
|
||||
lean::inc(x_5);
|
||||
lean::dec(x_1);
|
||||
x_6 = l_Lean_ElabException_Inhabited___closed__2;
|
||||
x_7 = lean::alloc_cnstr(1, 2, 0);
|
||||
lean::cnstr_set(x_7, 0, x_6);
|
||||
lean::cnstr_set(x_7, 1, x_5);
|
||||
return x_7;
|
||||
}
|
||||
}
|
||||
}
|
||||
obj* l_Lean_Elab_runIO(obj* x_1, obj* x_2) {
|
||||
_start:
|
||||
{
|
||||
obj* x_3;
|
||||
x_3 = lean::alloc_closure(reinterpret_cast<void*>(l_Lean_Elab_runIO___rarg), 1, 0);
|
||||
return x_3;
|
||||
}
|
||||
}
|
||||
obj* l_Lean_Elab_runIO___boxed(obj* x_1, obj* x_2) {
|
||||
_start:
|
||||
{
|
||||
obj* x_3;
|
||||
x_3 = l_Lean_Elab_runIO(x_1, x_2);
|
||||
lean::dec(x_2);
|
||||
return x_3;
|
||||
}
|
||||
}
|
||||
obj* initialize_init_lean_namegenerator(obj*);
|
||||
obj* initialize_init_lean_parser_module(obj*);
|
||||
static bool _G_initialized = false;
|
||||
obj* initialize_init_lean_elaborator_basic(obj* w) {
|
||||
if (_G_initialized) return w;
|
||||
_G_initialized = true;
|
||||
if (io_result_is_error(w)) return w;
|
||||
w = initialize_init_lean_namegenerator(w);
|
||||
if (io_result_is_error(w)) return w;
|
||||
w = initialize_init_lean_parser_module(w);
|
||||
if (io_result_is_error(w)) return w;
|
||||
l_Lean_ElabException_Inhabited___closed__1 = _init_l_Lean_ElabException_Inhabited___closed__1();
|
||||
lean::mark_persistent(l_Lean_ElabException_Inhabited___closed__1);
|
||||
l_Lean_ElabException_Inhabited___closed__2 = _init_l_Lean_ElabException_Inhabited___closed__2();
|
||||
lean::mark_persistent(l_Lean_ElabException_Inhabited___closed__2);
|
||||
l_Lean_ElabException_Inhabited = _init_l_Lean_ElabException_Inhabited();
|
||||
lean::mark_persistent(l_Lean_ElabException_Inhabited);
|
||||
lean::register_constant(lean::mk_const_name(lean::mk_const_name(lean::mk_const_name("Lean"), "ElabException"), "Inhabited"), l_Lean_ElabException_Inhabited);
|
||||
l_Lean_SMap_empty___at_Lean_mkBuiltinTermElabTable___spec__1___closed__1 = _init_l_Lean_SMap_empty___at_Lean_mkBuiltinTermElabTable___spec__1___closed__1();
|
||||
lean::mark_persistent(l_Lean_SMap_empty___at_Lean_mkBuiltinTermElabTable___spec__1___closed__1);
|
||||
l_Lean_SMap_empty___at_Lean_mkBuiltinTermElabTable___spec__1___closed__2 = _init_l_Lean_SMap_empty___at_Lean_mkBuiltinTermElabTable___spec__1___closed__2();
|
||||
lean::mark_persistent(l_Lean_SMap_empty___at_Lean_mkBuiltinTermElabTable___spec__1___closed__2);
|
||||
l_Lean_SMap_empty___at_Lean_mkBuiltinTermElabTable___spec__1 = _init_l_Lean_SMap_empty___at_Lean_mkBuiltinTermElabTable___spec__1();
|
||||
lean::mark_persistent(l_Lean_SMap_empty___at_Lean_mkBuiltinTermElabTable___spec__1);
|
||||
REGISTER_LEAN_FUNCTION(lean::mk_const_name(lean::mk_const_name("Lean"), "mkBuiltinTermElabTable"), 1, l_Lean_mkBuiltinTermElabTable);
|
||||
l_Lean_SMap_empty___at_Lean_mkBuiltinCommandElabTable___spec__1___closed__1 = _init_l_Lean_SMap_empty___at_Lean_mkBuiltinCommandElabTable___spec__1___closed__1();
|
||||
lean::mark_persistent(l_Lean_SMap_empty___at_Lean_mkBuiltinCommandElabTable___spec__1___closed__1);
|
||||
l_Lean_SMap_empty___at_Lean_mkBuiltinCommandElabTable___spec__1___closed__2 = _init_l_Lean_SMap_empty___at_Lean_mkBuiltinCommandElabTable___spec__1___closed__2();
|
||||
lean::mark_persistent(l_Lean_SMap_empty___at_Lean_mkBuiltinCommandElabTable___spec__1___closed__2);
|
||||
l_Lean_SMap_empty___at_Lean_mkBuiltinCommandElabTable___spec__1 = _init_l_Lean_SMap_empty___at_Lean_mkBuiltinCommandElabTable___spec__1();
|
||||
lean::mark_persistent(l_Lean_SMap_empty___at_Lean_mkBuiltinCommandElabTable___spec__1);
|
||||
REGISTER_LEAN_FUNCTION(lean::mk_const_name(lean::mk_const_name("Lean"), "mkBuiltinCommandElabTable"), 1, l_Lean_mkBuiltinCommandElabTable);
|
||||
w = l_Lean_mkBuiltinTermElabTable(w);
|
||||
if (io_result_is_error(w)) return w;
|
||||
l_Lean_builtinTermElabTable = io_result_get_value(w);
|
||||
lean::mark_persistent(l_Lean_builtinTermElabTable);
|
||||
lean::register_constant(lean::mk_const_name(lean::mk_const_name("Lean"), "builtinTermElabTable"), l_Lean_builtinTermElabTable);
|
||||
w = l_Lean_mkBuiltinCommandElabTable(w);
|
||||
if (io_result_is_error(w)) return w;
|
||||
l_Lean_builtinCommandElabTable = io_result_get_value(w);
|
||||
lean::mark_persistent(l_Lean_builtinCommandElabTable);
|
||||
lean::register_constant(lean::mk_const_name(lean::mk_const_name("Lean"), "builtinCommandElabTable"), l_Lean_builtinCommandElabTable);
|
||||
REGISTER_LEAN_FUNCTION(lean::mk_const_name(lean::mk_const_name("Lean"), "declareBuiltinTermElab"), 4, l_Lean_declareBuiltinTermElab___boxed);
|
||||
l_Lean_registerBuiltinTermElabAttr___lambda__1___closed__1 = _init_l_Lean_registerBuiltinTermElabAttr___lambda__1___closed__1();
|
||||
lean::mark_persistent(l_Lean_registerBuiltinTermElabAttr___lambda__1___closed__1);
|
||||
l_Lean_registerBuiltinTermElabAttr___lambda__1___closed__2 = _init_l_Lean_registerBuiltinTermElabAttr___lambda__1___closed__2();
|
||||
lean::mark_persistent(l_Lean_registerBuiltinTermElabAttr___lambda__1___closed__2);
|
||||
l_Lean_registerBuiltinTermElabAttr___lambda__1___closed__3 = _init_l_Lean_registerBuiltinTermElabAttr___lambda__1___closed__3();
|
||||
lean::mark_persistent(l_Lean_registerBuiltinTermElabAttr___lambda__1___closed__3);
|
||||
l_Lean_registerBuiltinTermElabAttr___lambda__1___closed__4 = _init_l_Lean_registerBuiltinTermElabAttr___lambda__1___closed__4();
|
||||
lean::mark_persistent(l_Lean_registerBuiltinTermElabAttr___lambda__1___closed__4);
|
||||
l_Lean_registerBuiltinTermElabAttr___lambda__1___closed__5 = _init_l_Lean_registerBuiltinTermElabAttr___lambda__1___closed__5();
|
||||
lean::mark_persistent(l_Lean_registerBuiltinTermElabAttr___lambda__1___closed__5);
|
||||
l_Lean_registerBuiltinTermElabAttr___lambda__1___closed__6 = _init_l_Lean_registerBuiltinTermElabAttr___lambda__1___closed__6();
|
||||
lean::mark_persistent(l_Lean_registerBuiltinTermElabAttr___lambda__1___closed__6);
|
||||
l_Lean_registerBuiltinTermElabAttr___lambda__1___closed__7 = _init_l_Lean_registerBuiltinTermElabAttr___lambda__1___closed__7();
|
||||
lean::mark_persistent(l_Lean_registerBuiltinTermElabAttr___lambda__1___closed__7);
|
||||
l_Lean_registerBuiltinTermElabAttr___closed__1 = _init_l_Lean_registerBuiltinTermElabAttr___closed__1();
|
||||
lean::mark_persistent(l_Lean_registerBuiltinTermElabAttr___closed__1);
|
||||
l_Lean_registerBuiltinTermElabAttr___closed__2 = _init_l_Lean_registerBuiltinTermElabAttr___closed__2();
|
||||
lean::mark_persistent(l_Lean_registerBuiltinTermElabAttr___closed__2);
|
||||
l_Lean_registerBuiltinTermElabAttr___closed__3 = _init_l_Lean_registerBuiltinTermElabAttr___closed__3();
|
||||
lean::mark_persistent(l_Lean_registerBuiltinTermElabAttr___closed__3);
|
||||
l_Lean_registerBuiltinTermElabAttr___closed__4 = _init_l_Lean_registerBuiltinTermElabAttr___closed__4();
|
||||
lean::mark_persistent(l_Lean_registerBuiltinTermElabAttr___closed__4);
|
||||
l_Lean_registerBuiltinTermElabAttr___closed__5 = _init_l_Lean_registerBuiltinTermElabAttr___closed__5();
|
||||
lean::mark_persistent(l_Lean_registerBuiltinTermElabAttr___closed__5);
|
||||
l_Lean_registerBuiltinTermElabAttr___closed__6 = _init_l_Lean_registerBuiltinTermElabAttr___closed__6();
|
||||
lean::mark_persistent(l_Lean_registerBuiltinTermElabAttr___closed__6);
|
||||
l_Lean_registerBuiltinTermElabAttr___closed__7 = _init_l_Lean_registerBuiltinTermElabAttr___closed__7();
|
||||
lean::mark_persistent(l_Lean_registerBuiltinTermElabAttr___closed__7);
|
||||
w = l_Lean_registerBuiltinTermElabAttr(w);
|
||||
if (io_result_is_error(w)) return w;
|
||||
REGISTER_LEAN_FUNCTION(lean::mk_const_name(lean::mk_const_name(lean::mk_const_name("Lean"), "Elab"), "runIOUnsafe"), 1, l_Lean_Elab_runIOUnsafe);
|
||||
REGISTER_LEAN_FUNCTION(lean::mk_const_name(lean::mk_const_name(lean::mk_const_name("Lean"), "Elab"), "runIO"), 2, l_Lean_Elab_runIO___boxed);
|
||||
return w;
|
||||
}
|
||||
5
src/stage0/init/lean/elaborator/default.cpp
generated
5
src/stage0/init/lean/elaborator/default.cpp
generated
|
|
@ -1,6 +1,6 @@
|
|||
// Lean compiler output
|
||||
// Module: init.lean.elaborator.default
|
||||
// Imports: init.lean.elaborator.elabstrategyattrs
|
||||
// Imports: init.lean.elaborator.basic init.lean.elaborator.elabstrategyattrs
|
||||
#include "runtime/object.h"
|
||||
#include "runtime/apply.h"
|
||||
typedef lean::object obj; typedef lean::usize usize;
|
||||
|
|
@ -14,12 +14,15 @@ typedef lean::uint32 uint32; typedef lean::uint64 uint64;
|
|||
#pragma GCC diagnostic ignored "-Wunused-label"
|
||||
#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
|
||||
#endif
|
||||
obj* initialize_init_lean_elaborator_basic(obj*);
|
||||
obj* initialize_init_lean_elaborator_elabstrategyattrs(obj*);
|
||||
static bool _G_initialized = false;
|
||||
obj* initialize_init_lean_elaborator_default(obj* w) {
|
||||
if (_G_initialized) return w;
|
||||
_G_initialized = true;
|
||||
if (io_result_is_error(w)) return w;
|
||||
w = initialize_init_lean_elaborator_basic(w);
|
||||
if (io_result_is_error(w)) return w;
|
||||
w = initialize_init_lean_elaborator_elabstrategyattrs(w);
|
||||
if (io_result_is_error(w)) return w;
|
||||
return w;
|
||||
|
|
|
|||
185
src/stage0/init/lean/namegenerator.cpp
generated
Normal file
185
src/stage0/init/lean/namegenerator.cpp
generated
Normal file
|
|
@ -0,0 +1,185 @@
|
|||
// Lean compiler output
|
||||
// Module: init.lean.namegenerator
|
||||
// Imports: init.lean.name
|
||||
#include "runtime/object.h"
|
||||
#include "runtime/apply.h"
|
||||
typedef lean::object obj; typedef lean::usize usize;
|
||||
typedef lean::uint8 uint8; typedef lean::uint16 uint16;
|
||||
typedef lean::uint32 uint32; typedef lean::uint64 uint64;
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic ignored "-Wunused-parameter"
|
||||
#pragma clang diagnostic ignored "-Wunused-label"
|
||||
#elif defined(__GNUC__) && !defined(__CLANG__)
|
||||
#pragma GCC diagnostic ignored "-Wunused-parameter"
|
||||
#pragma GCC diagnostic ignored "-Wunused-label"
|
||||
#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
|
||||
#endif
|
||||
obj* l_Lean_NameGenerator_mkChild(obj*);
|
||||
obj* l_Lean_NameGenerator_Inhabited___closed__1;
|
||||
obj* l_Lean_NameGenerator_next(obj*);
|
||||
obj* l_Lean_NameGenerator_Inhabited___closed__3;
|
||||
obj* l_Lean_NameGenerator_Inhabited___closed__2;
|
||||
extern "C" obj* lean_name_mk_string(obj*, obj*);
|
||||
namespace lean {
|
||||
obj* nat_add(obj*, obj*);
|
||||
}
|
||||
extern "C" obj* lean_name_mk_numeral(obj*, obj*);
|
||||
obj* l_Lean_NameGenerator_Inhabited;
|
||||
obj* _init_l_Lean_NameGenerator_Inhabited___closed__1() {
|
||||
_start:
|
||||
{
|
||||
obj* x_1;
|
||||
x_1 = lean::mk_string("_uniq");
|
||||
return x_1;
|
||||
}
|
||||
}
|
||||
obj* _init_l_Lean_NameGenerator_Inhabited___closed__2() {
|
||||
_start:
|
||||
{
|
||||
obj* x_1; obj* x_2; obj* x_3;
|
||||
x_1 = lean::box(0);
|
||||
x_2 = l_Lean_NameGenerator_Inhabited___closed__1;
|
||||
x_3 = lean_name_mk_string(x_1, x_2);
|
||||
return x_3;
|
||||
}
|
||||
}
|
||||
obj* _init_l_Lean_NameGenerator_Inhabited___closed__3() {
|
||||
_start:
|
||||
{
|
||||
obj* x_1; obj* x_2; obj* x_3;
|
||||
x_1 = l_Lean_NameGenerator_Inhabited___closed__2;
|
||||
x_2 = lean::mk_nat_obj(1u);
|
||||
x_3 = lean::alloc_cnstr(0, 2, 0);
|
||||
lean::cnstr_set(x_3, 0, x_1);
|
||||
lean::cnstr_set(x_3, 1, x_2);
|
||||
return x_3;
|
||||
}
|
||||
}
|
||||
obj* _init_l_Lean_NameGenerator_Inhabited() {
|
||||
_start:
|
||||
{
|
||||
obj* x_1;
|
||||
x_1 = l_Lean_NameGenerator_Inhabited___closed__3;
|
||||
return x_1;
|
||||
}
|
||||
}
|
||||
obj* l_Lean_NameGenerator_next(obj* x_1) {
|
||||
_start:
|
||||
{
|
||||
uint8 x_2;
|
||||
x_2 = !lean::is_exclusive(x_1);
|
||||
if (x_2 == 0)
|
||||
{
|
||||
obj* x_3; obj* x_4; obj* x_5; obj* x_6; obj* x_7; obj* x_8;
|
||||
x_3 = lean::cnstr_get(x_1, 0);
|
||||
x_4 = lean::cnstr_get(x_1, 1);
|
||||
lean::inc(x_4);
|
||||
lean::inc(x_3);
|
||||
x_5 = lean_name_mk_numeral(x_3, x_4);
|
||||
x_6 = lean::mk_nat_obj(1u);
|
||||
x_7 = lean::nat_add(x_4, x_6);
|
||||
lean::dec(x_4);
|
||||
lean::cnstr_set(x_1, 1, x_7);
|
||||
x_8 = lean::alloc_cnstr(0, 2, 0);
|
||||
lean::cnstr_set(x_8, 0, x_5);
|
||||
lean::cnstr_set(x_8, 1, x_1);
|
||||
return x_8;
|
||||
}
|
||||
else
|
||||
{
|
||||
obj* x_9; obj* x_10; obj* x_11; obj* x_12; obj* x_13; obj* x_14; obj* x_15;
|
||||
x_9 = lean::cnstr_get(x_1, 0);
|
||||
x_10 = lean::cnstr_get(x_1, 1);
|
||||
lean::inc(x_10);
|
||||
lean::inc(x_9);
|
||||
lean::dec(x_1);
|
||||
lean::inc(x_10);
|
||||
lean::inc(x_9);
|
||||
x_11 = lean_name_mk_numeral(x_9, x_10);
|
||||
x_12 = lean::mk_nat_obj(1u);
|
||||
x_13 = lean::nat_add(x_10, x_12);
|
||||
lean::dec(x_10);
|
||||
x_14 = lean::alloc_cnstr(0, 2, 0);
|
||||
lean::cnstr_set(x_14, 0, x_9);
|
||||
lean::cnstr_set(x_14, 1, x_13);
|
||||
x_15 = lean::alloc_cnstr(0, 2, 0);
|
||||
lean::cnstr_set(x_15, 0, x_11);
|
||||
lean::cnstr_set(x_15, 1, x_14);
|
||||
return x_15;
|
||||
}
|
||||
}
|
||||
}
|
||||
obj* l_Lean_NameGenerator_mkChild(obj* x_1) {
|
||||
_start:
|
||||
{
|
||||
uint8 x_2;
|
||||
x_2 = !lean::is_exclusive(x_1);
|
||||
if (x_2 == 0)
|
||||
{
|
||||
obj* x_3; obj* x_4; obj* x_5; obj* x_6; obj* x_7; obj* x_8; obj* x_9;
|
||||
x_3 = lean::cnstr_get(x_1, 0);
|
||||
x_4 = lean::cnstr_get(x_1, 1);
|
||||
lean::inc(x_4);
|
||||
lean::inc(x_3);
|
||||
x_5 = lean_name_mk_numeral(x_3, x_4);
|
||||
x_6 = lean::mk_nat_obj(1u);
|
||||
lean::cnstr_set(x_1, 1, x_6);
|
||||
lean::cnstr_set(x_1, 0, x_5);
|
||||
x_7 = lean::nat_add(x_4, x_6);
|
||||
lean::dec(x_4);
|
||||
x_8 = lean::alloc_cnstr(0, 2, 0);
|
||||
lean::cnstr_set(x_8, 0, x_3);
|
||||
lean::cnstr_set(x_8, 1, x_7);
|
||||
x_9 = lean::alloc_cnstr(0, 2, 0);
|
||||
lean::cnstr_set(x_9, 0, x_1);
|
||||
lean::cnstr_set(x_9, 1, x_8);
|
||||
return x_9;
|
||||
}
|
||||
else
|
||||
{
|
||||
obj* x_10; obj* x_11; obj* x_12; obj* x_13; obj* x_14; obj* x_15; obj* x_16; obj* x_17;
|
||||
x_10 = lean::cnstr_get(x_1, 0);
|
||||
x_11 = lean::cnstr_get(x_1, 1);
|
||||
lean::inc(x_11);
|
||||
lean::inc(x_10);
|
||||
lean::dec(x_1);
|
||||
lean::inc(x_11);
|
||||
lean::inc(x_10);
|
||||
x_12 = lean_name_mk_numeral(x_10, x_11);
|
||||
x_13 = lean::mk_nat_obj(1u);
|
||||
x_14 = lean::alloc_cnstr(0, 2, 0);
|
||||
lean::cnstr_set(x_14, 0, x_12);
|
||||
lean::cnstr_set(x_14, 1, x_13);
|
||||
x_15 = lean::nat_add(x_11, x_13);
|
||||
lean::dec(x_11);
|
||||
x_16 = lean::alloc_cnstr(0, 2, 0);
|
||||
lean::cnstr_set(x_16, 0, x_10);
|
||||
lean::cnstr_set(x_16, 1, x_15);
|
||||
x_17 = lean::alloc_cnstr(0, 2, 0);
|
||||
lean::cnstr_set(x_17, 0, x_14);
|
||||
lean::cnstr_set(x_17, 1, x_16);
|
||||
return x_17;
|
||||
}
|
||||
}
|
||||
}
|
||||
obj* initialize_init_lean_name(obj*);
|
||||
static bool _G_initialized = false;
|
||||
obj* initialize_init_lean_namegenerator(obj* w) {
|
||||
if (_G_initialized) return w;
|
||||
_G_initialized = true;
|
||||
if (io_result_is_error(w)) return w;
|
||||
w = initialize_init_lean_name(w);
|
||||
if (io_result_is_error(w)) return w;
|
||||
l_Lean_NameGenerator_Inhabited___closed__1 = _init_l_Lean_NameGenerator_Inhabited___closed__1();
|
||||
lean::mark_persistent(l_Lean_NameGenerator_Inhabited___closed__1);
|
||||
l_Lean_NameGenerator_Inhabited___closed__2 = _init_l_Lean_NameGenerator_Inhabited___closed__2();
|
||||
lean::mark_persistent(l_Lean_NameGenerator_Inhabited___closed__2);
|
||||
l_Lean_NameGenerator_Inhabited___closed__3 = _init_l_Lean_NameGenerator_Inhabited___closed__3();
|
||||
lean::mark_persistent(l_Lean_NameGenerator_Inhabited___closed__3);
|
||||
l_Lean_NameGenerator_Inhabited = _init_l_Lean_NameGenerator_Inhabited();
|
||||
lean::mark_persistent(l_Lean_NameGenerator_Inhabited);
|
||||
lean::register_constant(lean::mk_const_name(lean::mk_const_name(lean::mk_const_name("Lean"), "NameGenerator"), "Inhabited"), l_Lean_NameGenerator_Inhabited);
|
||||
REGISTER_LEAN_FUNCTION(lean::mk_const_name(lean::mk_const_name(lean::mk_const_name("Lean"), "NameGenerator"), "next"), 1, l_Lean_NameGenerator_next);
|
||||
REGISTER_LEAN_FUNCTION(lean::mk_const_name(lean::mk_const_name(lean::mk_const_name("Lean"), "NameGenerator"), "mkChild"), 1, l_Lean_NameGenerator_mkChild);
|
||||
return w;
|
||||
}
|
||||
508
src/stage0/init/lean/parser/module.cpp
generated
508
src/stage0/init/lean/parser/module.cpp
generated
|
|
@ -23,6 +23,7 @@ obj* l_Lean_Parser_Module_importPath___elambda__1(obj*, obj*, obj*);
|
|||
obj* l_Lean_FileMap_toPosition___main(obj*, obj*);
|
||||
extern obj* l_Array_empty___closed__1;
|
||||
obj* l_Lean_Parser_whitespace___main(obj*, obj*);
|
||||
obj* l_Lean_Format_pretty(obj*, obj*);
|
||||
obj* l_Lean_Parser_ParserState_restore(obj*, obj*, obj*);
|
||||
obj* l_Lean_Parser_Module_importPath___elambda__1___closed__1;
|
||||
obj* l___private_init_lean_parser_module_1__mkErrorMessage(obj*, obj*, obj*);
|
||||
|
|
@ -50,6 +51,7 @@ obj* l_Lean_Parser_initCacheForInput(obj*);
|
|||
obj* l_List_reverse___rarg(obj*);
|
||||
obj* l_Lean_Parser_Module_prelude___closed__1;
|
||||
obj* l_Lean_Parser_Module_prelude___elambda__1___rarg___closed__7;
|
||||
obj* l_Lean_Syntax_formatStx___main(obj*);
|
||||
obj* l_Lean_Parser_Module_header___elambda__1___boxed(obj*, obj*, obj*);
|
||||
uint8 l_Lean_Syntax_isOfKind___main(obj*, obj*);
|
||||
obj* l_Lean_Parser_rawCh(uint8, uint32, uint8);
|
||||
|
|
@ -59,6 +61,7 @@ obj* l_Lean_Parser_isExitCommand___boxed(obj*);
|
|||
obj* l_Lean_Parser_Module_importPath___closed__2;
|
||||
obj* l___private_init_lean_parser_module_4__testModuleParserAux___boxed(obj*, obj*, obj*, obj*);
|
||||
obj* l_Lean_Parser_Module_importPath___closed__6;
|
||||
extern obj* l_Lean_Options_empty;
|
||||
obj* l_Lean_Parser_mkParserState(obj*);
|
||||
obj* l_Array_mkEmpty(obj*, obj*);
|
||||
obj* l_Lean_Parser_Module_header___elambda__1___closed__2;
|
||||
|
|
@ -68,7 +71,7 @@ obj* l___private_init_lean_parser_module_3__consumeInput(obj*, obj*);
|
|||
obj* l_Lean_Parser_ParserState_mkNode(obj*, obj*, obj*);
|
||||
obj* l_Lean_Parser_manyAux___main___at_Lean_Parser_Module_import___elambda__1___spec__1___boxed(obj*, obj*, obj*, obj*);
|
||||
obj* l_Lean_Parser_Module_header___closed__1;
|
||||
obj* l___private_init_lean_parser_module_4__testModuleParserAux___main(obj*, obj*, obj*);
|
||||
obj* l___private_init_lean_parser_module_4__testModuleParserAux___main(obj*, uint8, obj*, obj*);
|
||||
obj* l_Lean_Parser_Module_import___closed__3;
|
||||
obj* l_Lean_Parser_Module_header___elambda__1___closed__1;
|
||||
obj* l_Lean_Parser_isEOI___boxed(obj*);
|
||||
|
|
@ -95,6 +98,7 @@ namespace lean {
|
|||
obj* nat_add(obj*, obj*);
|
||||
}
|
||||
extern obj* l_Lean_nullKind;
|
||||
obj* l_IO_print___at___private_init_lean_parser_module_4__testModuleParserAux___main___spec__4(obj*, obj*);
|
||||
obj* l_Lean_Parser_Module_prelude___elambda__1___rarg___closed__8;
|
||||
obj* l_Lean_Parser_Module_import___elambda__1___closed__6;
|
||||
obj* l_Lean_Parser_Module_import___elambda__1___closed__3;
|
||||
|
|
@ -116,6 +120,7 @@ obj* l_Lean_Parser_Module_prelude___closed__2;
|
|||
obj* l_Lean_Parser_manyAux___main___at_Lean_Parser_Module_importPath___elambda__1___spec__1(uint8, obj*, obj*, obj*);
|
||||
obj* l_Lean_Parser_noFirstTokenInfo(obj*);
|
||||
obj* l_Lean_Parser_ModuleParser_inhabited___closed__1;
|
||||
obj* l___private_init_lean_parser_module_4__testModuleParserAux___main___boxed(obj*, obj*, obj*, obj*);
|
||||
obj* l_Lean_Parser_manyAux___main___at_Lean_Parser_Module_import___elambda__1___spec__1(uint8, obj*, obj*, obj*);
|
||||
obj* l_Lean_Parser_parseCommand___main(obj*, obj*);
|
||||
uint8 l_Lean_Parser_isEOI(obj*);
|
||||
|
|
@ -129,10 +134,12 @@ obj* l_Lean_Parser_identFn___rarg(obj*, obj*);
|
|||
obj* l_Lean_Parser_Module_header___elambda__1(obj*, obj*, obj*);
|
||||
obj* l_String_trim(obj*);
|
||||
obj* l_Lean_Parser_Module_updateTokens(obj*);
|
||||
obj* l_IO_println___at___private_init_lean_parser_module_4__testModuleParserAux___main___spec__3(obj*, obj*);
|
||||
obj* l_Lean_Parser_Module_importPath;
|
||||
obj* l_Lean_Parser_Module_prelude___closed__4;
|
||||
obj* l_Lean_Parser_Module_prelude___elambda__1(obj*);
|
||||
extern obj* l_Lean_Parser_ParserContextCore_inhabited___closed__1;
|
||||
obj* l_List_mfor___main___at___private_init_lean_parser_module_4__testModuleParserAux___main___spec__5(obj*, obj*);
|
||||
obj* l_Lean_Parser_nodeInfo(obj*);
|
||||
obj* l_Lean_Message_toString(obj*);
|
||||
obj* l_Array_size(obj*, obj*);
|
||||
|
|
@ -159,7 +166,6 @@ obj* l_Lean_Parser_ParserState_mkErrorsAt(obj*, obj*, obj*);
|
|||
obj* l_Lean_Parser_ModuleParser_inhabited;
|
||||
obj* l_Lean_Parser_Module_prelude___elambda__1___rarg___closed__4;
|
||||
obj* l_Lean_Parser_Module_importPath___closed__5;
|
||||
obj* l_List_mfor___main___at___private_init_lean_parser_module_4__testModuleParserAux___main___spec__3(obj*, obj*);
|
||||
extern obj* l_String_splitAux___main___closed__1;
|
||||
obj* _init_l_Lean_Parser_Module_prelude___elambda__1___rarg___closed__1() {
|
||||
_start:
|
||||
|
|
@ -1855,11 +1861,13 @@ return x_3;
|
|||
obj* l_IO_print___at___private_init_lean_parser_module_4__testModuleParserAux___main___spec__2(obj* x_1, obj* x_2) {
|
||||
_start:
|
||||
{
|
||||
obj* x_3; obj* x_4;
|
||||
x_3 = l_Lean_Message_toString(x_1);
|
||||
x_4 = lean_io_prim_put_str(x_3, x_2);
|
||||
lean::dec(x_3);
|
||||
return x_4;
|
||||
obj* x_3; obj* x_4; obj* x_5; obj* x_6;
|
||||
x_3 = l_Lean_Syntax_formatStx___main(x_1);
|
||||
x_4 = l_Lean_Options_empty;
|
||||
x_5 = l_Lean_Format_pretty(x_3, x_4);
|
||||
x_6 = lean_io_prim_put_str(x_5, x_2);
|
||||
lean::dec(x_5);
|
||||
return x_6;
|
||||
}
|
||||
}
|
||||
obj* l_IO_println___at___private_init_lean_parser_module_4__testModuleParserAux___main___spec__1(obj* x_1, obj* x_2) {
|
||||
|
|
@ -1921,7 +1929,76 @@ return x_17;
|
|||
}
|
||||
}
|
||||
}
|
||||
obj* l_List_mfor___main___at___private_init_lean_parser_module_4__testModuleParserAux___main___spec__3(obj* x_1, obj* x_2) {
|
||||
obj* l_IO_print___at___private_init_lean_parser_module_4__testModuleParserAux___main___spec__4(obj* x_1, obj* x_2) {
|
||||
_start:
|
||||
{
|
||||
obj* x_3; obj* x_4;
|
||||
x_3 = l_Lean_Message_toString(x_1);
|
||||
x_4 = lean_io_prim_put_str(x_3, x_2);
|
||||
lean::dec(x_3);
|
||||
return x_4;
|
||||
}
|
||||
}
|
||||
obj* l_IO_println___at___private_init_lean_parser_module_4__testModuleParserAux___main___spec__3(obj* x_1, obj* x_2) {
|
||||
_start:
|
||||
{
|
||||
obj* x_3;
|
||||
x_3 = l_IO_print___at___private_init_lean_parser_module_4__testModuleParserAux___main___spec__4(x_1, x_2);
|
||||
if (lean::obj_tag(x_3) == 0)
|
||||
{
|
||||
uint8 x_4;
|
||||
x_4 = !lean::is_exclusive(x_3);
|
||||
if (x_4 == 0)
|
||||
{
|
||||
obj* x_5; obj* x_6; obj* x_7; obj* x_8;
|
||||
x_5 = lean::cnstr_get(x_3, 0);
|
||||
lean::dec(x_5);
|
||||
x_6 = lean::box(0);
|
||||
lean::cnstr_set(x_3, 0, x_6);
|
||||
x_7 = l_IO_println___rarg___closed__1;
|
||||
x_8 = lean_io_prim_put_str(x_7, x_3);
|
||||
return x_8;
|
||||
}
|
||||
else
|
||||
{
|
||||
obj* x_9; obj* x_10; obj* x_11; obj* x_12; obj* x_13;
|
||||
x_9 = lean::cnstr_get(x_3, 1);
|
||||
lean::inc(x_9);
|
||||
lean::dec(x_3);
|
||||
x_10 = lean::box(0);
|
||||
x_11 = lean::alloc_cnstr(0, 2, 0);
|
||||
lean::cnstr_set(x_11, 0, x_10);
|
||||
lean::cnstr_set(x_11, 1, x_9);
|
||||
x_12 = l_IO_println___rarg___closed__1;
|
||||
x_13 = lean_io_prim_put_str(x_12, x_11);
|
||||
return x_13;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
uint8 x_14;
|
||||
x_14 = !lean::is_exclusive(x_3);
|
||||
if (x_14 == 0)
|
||||
{
|
||||
return x_3;
|
||||
}
|
||||
else
|
||||
{
|
||||
obj* x_15; obj* x_16; obj* x_17;
|
||||
x_15 = lean::cnstr_get(x_3, 0);
|
||||
x_16 = lean::cnstr_get(x_3, 1);
|
||||
lean::inc(x_16);
|
||||
lean::inc(x_15);
|
||||
lean::dec(x_3);
|
||||
x_17 = lean::alloc_cnstr(1, 2, 0);
|
||||
lean::cnstr_set(x_17, 0, x_15);
|
||||
lean::cnstr_set(x_17, 1, x_16);
|
||||
return x_17;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
obj* l_List_mfor___main___at___private_init_lean_parser_module_4__testModuleParserAux___main___spec__5(obj* x_1, obj* x_2) {
|
||||
_start:
|
||||
{
|
||||
if (lean::obj_tag(x_1) == 0)
|
||||
|
|
@ -1958,7 +2035,7 @@ lean::inc(x_9);
|
|||
x_10 = lean::cnstr_get(x_1, 1);
|
||||
lean::inc(x_10);
|
||||
lean::dec(x_1);
|
||||
x_11 = l_IO_println___at___private_init_lean_parser_module_4__testModuleParserAux___main___spec__1(x_9, x_2);
|
||||
x_11 = l_IO_println___at___private_init_lean_parser_module_4__testModuleParserAux___main___spec__3(x_9, x_2);
|
||||
if (lean::obj_tag(x_11) == 0)
|
||||
{
|
||||
uint8 x_12;
|
||||
|
|
@ -2015,221 +2092,318 @@ return x_23;
|
|||
}
|
||||
}
|
||||
}
|
||||
obj* l___private_init_lean_parser_module_4__testModuleParserAux___main(obj* x_1, obj* x_2, obj* x_3) {
|
||||
obj* l___private_init_lean_parser_module_4__testModuleParserAux___main(obj* x_1, uint8 x_2, obj* x_3, obj* x_4) {
|
||||
_start:
|
||||
{
|
||||
obj* x_4; obj* x_5; obj* x_6; uint8 x_7;
|
||||
obj* x_5; obj* x_6; obj* x_7; uint8 x_8;
|
||||
lean::inc(x_1);
|
||||
x_4 = l_Lean_Parser_parseCommand___main(x_1, x_2);
|
||||
x_5 = lean::cnstr_get(x_4, 0);
|
||||
lean::inc(x_5);
|
||||
x_6 = lean::cnstr_get(x_4, 1);
|
||||
x_5 = l_Lean_Parser_parseCommand___main(x_1, x_3);
|
||||
x_6 = lean::cnstr_get(x_5, 0);
|
||||
lean::inc(x_6);
|
||||
lean::dec(x_4);
|
||||
x_7 = l_Lean_Parser_isEOI(x_5);
|
||||
if (x_7 == 0)
|
||||
{
|
||||
uint8 x_8;
|
||||
x_8 = l_Lean_Parser_isExitCommand(x_5);
|
||||
x_7 = lean::cnstr_get(x_5, 1);
|
||||
lean::inc(x_7);
|
||||
lean::dec(x_5);
|
||||
x_8 = l_Lean_Parser_isEOI(x_6);
|
||||
if (x_8 == 0)
|
||||
{
|
||||
x_2 = x_6;
|
||||
uint8 x_9;
|
||||
x_9 = l_Lean_Parser_isExitCommand(x_6);
|
||||
if (x_9 == 0)
|
||||
{
|
||||
if (x_2 == 0)
|
||||
{
|
||||
uint8 x_10;
|
||||
lean::dec(x_6);
|
||||
x_10 = !lean::is_exclusive(x_4);
|
||||
if (x_10 == 0)
|
||||
{
|
||||
obj* x_11; obj* x_12;
|
||||
x_11 = lean::cnstr_get(x_4, 0);
|
||||
lean::dec(x_11);
|
||||
x_12 = lean::box(0);
|
||||
lean::cnstr_set(x_4, 0, x_12);
|
||||
x_3 = x_7;
|
||||
goto _start;
|
||||
}
|
||||
else
|
||||
{
|
||||
obj* x_10; obj* x_11; obj* x_12;
|
||||
lean::dec(x_1);
|
||||
x_10 = lean::cnstr_get(x_6, 2);
|
||||
lean::inc(x_10);
|
||||
lean::dec(x_6);
|
||||
lean::inc(x_10);
|
||||
x_11 = l_List_reverse___rarg(x_10);
|
||||
x_12 = l_List_mfor___main___at___private_init_lean_parser_module_4__testModuleParserAux___main___spec__3(x_11, x_3);
|
||||
if (lean::obj_tag(x_12) == 0)
|
||||
{
|
||||
uint8 x_13;
|
||||
x_13 = !lean::is_exclusive(x_12);
|
||||
if (x_13 == 0)
|
||||
{
|
||||
obj* x_14; uint8 x_15; uint8 x_16;
|
||||
x_14 = lean::cnstr_get(x_12, 0);
|
||||
lean::dec(x_14);
|
||||
x_15 = 0;
|
||||
x_16 = l_List_foldr___main___at_Lean_MessageLog_hasErrors___spec__1(x_15, x_10);
|
||||
lean::dec(x_10);
|
||||
if (x_16 == 0)
|
||||
{
|
||||
uint8 x_17; obj* x_18;
|
||||
x_17 = 1;
|
||||
x_18 = lean::box(x_17);
|
||||
lean::cnstr_set(x_12, 0, x_18);
|
||||
return x_12;
|
||||
}
|
||||
else
|
||||
{
|
||||
obj* x_19;
|
||||
x_19 = lean::box(x_15);
|
||||
lean::cnstr_set(x_12, 0, x_19);
|
||||
return x_12;
|
||||
obj* x_14; obj* x_15; obj* x_16;
|
||||
x_14 = lean::cnstr_get(x_4, 1);
|
||||
lean::inc(x_14);
|
||||
lean::dec(x_4);
|
||||
x_15 = lean::box(0);
|
||||
x_16 = lean::alloc_cnstr(0, 2, 0);
|
||||
lean::cnstr_set(x_16, 0, x_15);
|
||||
lean::cnstr_set(x_16, 1, x_14);
|
||||
x_3 = x_7;
|
||||
x_4 = x_16;
|
||||
goto _start;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
obj* x_20; uint8 x_21; uint8 x_22;
|
||||
x_20 = lean::cnstr_get(x_12, 1);
|
||||
lean::inc(x_20);
|
||||
lean::dec(x_12);
|
||||
x_21 = 0;
|
||||
x_22 = l_List_foldr___main___at_Lean_MessageLog_hasErrors___spec__1(x_21, x_10);
|
||||
lean::dec(x_10);
|
||||
if (x_22 == 0)
|
||||
obj* x_18;
|
||||
x_18 = l_IO_println___at___private_init_lean_parser_module_4__testModuleParserAux___main___spec__1(x_6, x_4);
|
||||
if (lean::obj_tag(x_18) == 0)
|
||||
{
|
||||
uint8 x_23; obj* x_24; obj* x_25;
|
||||
x_23 = 1;
|
||||
x_24 = lean::box(x_23);
|
||||
uint8 x_19;
|
||||
x_19 = !lean::is_exclusive(x_18);
|
||||
if (x_19 == 0)
|
||||
{
|
||||
obj* x_20; obj* x_21;
|
||||
x_20 = lean::cnstr_get(x_18, 0);
|
||||
lean::dec(x_20);
|
||||
x_21 = lean::box(0);
|
||||
lean::cnstr_set(x_18, 0, x_21);
|
||||
x_3 = x_7;
|
||||
x_4 = x_18;
|
||||
goto _start;
|
||||
}
|
||||
else
|
||||
{
|
||||
obj* x_23; obj* x_24; obj* x_25;
|
||||
x_23 = lean::cnstr_get(x_18, 1);
|
||||
lean::inc(x_23);
|
||||
lean::dec(x_18);
|
||||
x_24 = lean::box(0);
|
||||
x_25 = lean::alloc_cnstr(0, 2, 0);
|
||||
lean::cnstr_set(x_25, 0, x_24);
|
||||
lean::cnstr_set(x_25, 1, x_20);
|
||||
return x_25;
|
||||
}
|
||||
else
|
||||
{
|
||||
obj* x_26; obj* x_27;
|
||||
x_26 = lean::box(x_21);
|
||||
x_27 = lean::alloc_cnstr(0, 2, 0);
|
||||
lean::cnstr_set(x_27, 0, x_26);
|
||||
lean::cnstr_set(x_27, 1, x_20);
|
||||
return x_27;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
uint8 x_28;
|
||||
lean::dec(x_10);
|
||||
x_28 = !lean::is_exclusive(x_12);
|
||||
if (x_28 == 0)
|
||||
{
|
||||
return x_12;
|
||||
}
|
||||
else
|
||||
{
|
||||
obj* x_29; obj* x_30; obj* x_31;
|
||||
x_29 = lean::cnstr_get(x_12, 0);
|
||||
x_30 = lean::cnstr_get(x_12, 1);
|
||||
lean::inc(x_30);
|
||||
lean::inc(x_29);
|
||||
lean::dec(x_12);
|
||||
x_31 = lean::alloc_cnstr(1, 2, 0);
|
||||
lean::cnstr_set(x_31, 0, x_29);
|
||||
lean::cnstr_set(x_31, 1, x_30);
|
||||
return x_31;
|
||||
}
|
||||
}
|
||||
lean::cnstr_set(x_25, 1, x_23);
|
||||
x_3 = x_7;
|
||||
x_4 = x_25;
|
||||
goto _start;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
obj* x_32; obj* x_33; obj* x_34;
|
||||
lean::dec(x_5);
|
||||
uint8 x_27;
|
||||
lean::dec(x_7);
|
||||
lean::dec(x_1);
|
||||
x_32 = lean::cnstr_get(x_6, 2);
|
||||
lean::inc(x_32);
|
||||
x_27 = !lean::is_exclusive(x_18);
|
||||
if (x_27 == 0)
|
||||
{
|
||||
return x_18;
|
||||
}
|
||||
else
|
||||
{
|
||||
obj* x_28; obj* x_29; obj* x_30;
|
||||
x_28 = lean::cnstr_get(x_18, 0);
|
||||
x_29 = lean::cnstr_get(x_18, 1);
|
||||
lean::inc(x_29);
|
||||
lean::inc(x_28);
|
||||
lean::dec(x_18);
|
||||
x_30 = lean::alloc_cnstr(1, 2, 0);
|
||||
lean::cnstr_set(x_30, 0, x_28);
|
||||
lean::cnstr_set(x_30, 1, x_29);
|
||||
return x_30;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
obj* x_31; obj* x_32; obj* x_33;
|
||||
lean::dec(x_6);
|
||||
lean::inc(x_32);
|
||||
x_33 = l_List_reverse___rarg(x_32);
|
||||
x_34 = l_List_mfor___main___at___private_init_lean_parser_module_4__testModuleParserAux___main___spec__3(x_33, x_3);
|
||||
if (lean::obj_tag(x_34) == 0)
|
||||
lean::dec(x_1);
|
||||
x_31 = lean::cnstr_get(x_7, 2);
|
||||
lean::inc(x_31);
|
||||
lean::dec(x_7);
|
||||
lean::inc(x_31);
|
||||
x_32 = l_List_reverse___rarg(x_31);
|
||||
x_33 = l_List_mfor___main___at___private_init_lean_parser_module_4__testModuleParserAux___main___spec__5(x_32, x_4);
|
||||
if (lean::obj_tag(x_33) == 0)
|
||||
{
|
||||
uint8 x_35;
|
||||
x_35 = !lean::is_exclusive(x_34);
|
||||
if (x_35 == 0)
|
||||
uint8 x_34;
|
||||
x_34 = !lean::is_exclusive(x_33);
|
||||
if (x_34 == 0)
|
||||
{
|
||||
obj* x_36; uint8 x_37; uint8 x_38;
|
||||
x_36 = lean::cnstr_get(x_34, 0);
|
||||
lean::dec(x_36);
|
||||
x_37 = 0;
|
||||
x_38 = l_List_foldr___main___at_Lean_MessageLog_hasErrors___spec__1(x_37, x_32);
|
||||
lean::dec(x_32);
|
||||
if (x_38 == 0)
|
||||
obj* x_35; uint8 x_36; uint8 x_37;
|
||||
x_35 = lean::cnstr_get(x_33, 0);
|
||||
lean::dec(x_35);
|
||||
x_36 = 0;
|
||||
x_37 = l_List_foldr___main___at_Lean_MessageLog_hasErrors___spec__1(x_36, x_31);
|
||||
lean::dec(x_31);
|
||||
if (x_37 == 0)
|
||||
{
|
||||
uint8 x_39; obj* x_40;
|
||||
x_39 = 1;
|
||||
x_40 = lean::box(x_39);
|
||||
lean::cnstr_set(x_34, 0, x_40);
|
||||
return x_34;
|
||||
uint8 x_38; obj* x_39;
|
||||
x_38 = 1;
|
||||
x_39 = lean::box(x_38);
|
||||
lean::cnstr_set(x_33, 0, x_39);
|
||||
return x_33;
|
||||
}
|
||||
else
|
||||
{
|
||||
obj* x_41;
|
||||
x_41 = lean::box(x_37);
|
||||
lean::cnstr_set(x_34, 0, x_41);
|
||||
return x_34;
|
||||
obj* x_40;
|
||||
x_40 = lean::box(x_36);
|
||||
lean::cnstr_set(x_33, 0, x_40);
|
||||
return x_33;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
obj* x_42; uint8 x_43; uint8 x_44;
|
||||
x_42 = lean::cnstr_get(x_34, 1);
|
||||
lean::inc(x_42);
|
||||
lean::dec(x_34);
|
||||
x_43 = 0;
|
||||
x_44 = l_List_foldr___main___at_Lean_MessageLog_hasErrors___spec__1(x_43, x_32);
|
||||
lean::dec(x_32);
|
||||
if (x_44 == 0)
|
||||
obj* x_41; uint8 x_42; uint8 x_43;
|
||||
x_41 = lean::cnstr_get(x_33, 1);
|
||||
lean::inc(x_41);
|
||||
lean::dec(x_33);
|
||||
x_42 = 0;
|
||||
x_43 = l_List_foldr___main___at_Lean_MessageLog_hasErrors___spec__1(x_42, x_31);
|
||||
lean::dec(x_31);
|
||||
if (x_43 == 0)
|
||||
{
|
||||
uint8 x_45; obj* x_46; obj* x_47;
|
||||
x_45 = 1;
|
||||
x_46 = lean::box(x_45);
|
||||
x_47 = lean::alloc_cnstr(0, 2, 0);
|
||||
lean::cnstr_set(x_47, 0, x_46);
|
||||
lean::cnstr_set(x_47, 1, x_42);
|
||||
return x_47;
|
||||
uint8 x_44; obj* x_45; obj* x_46;
|
||||
x_44 = 1;
|
||||
x_45 = lean::box(x_44);
|
||||
x_46 = lean::alloc_cnstr(0, 2, 0);
|
||||
lean::cnstr_set(x_46, 0, x_45);
|
||||
lean::cnstr_set(x_46, 1, x_41);
|
||||
return x_46;
|
||||
}
|
||||
else
|
||||
{
|
||||
obj* x_48; obj* x_49;
|
||||
x_48 = lean::box(x_43);
|
||||
x_49 = lean::alloc_cnstr(0, 2, 0);
|
||||
lean::cnstr_set(x_49, 0, x_48);
|
||||
lean::cnstr_set(x_49, 1, x_42);
|
||||
return x_49;
|
||||
obj* x_47; obj* x_48;
|
||||
x_47 = lean::box(x_42);
|
||||
x_48 = lean::alloc_cnstr(0, 2, 0);
|
||||
lean::cnstr_set(x_48, 0, x_47);
|
||||
lean::cnstr_set(x_48, 1, x_41);
|
||||
return x_48;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
uint8 x_50;
|
||||
lean::dec(x_32);
|
||||
x_50 = !lean::is_exclusive(x_34);
|
||||
if (x_50 == 0)
|
||||
uint8 x_49;
|
||||
lean::dec(x_31);
|
||||
x_49 = !lean::is_exclusive(x_33);
|
||||
if (x_49 == 0)
|
||||
{
|
||||
return x_34;
|
||||
return x_33;
|
||||
}
|
||||
else
|
||||
{
|
||||
obj* x_51; obj* x_52; obj* x_53;
|
||||
x_51 = lean::cnstr_get(x_34, 0);
|
||||
x_52 = lean::cnstr_get(x_34, 1);
|
||||
lean::inc(x_52);
|
||||
obj* x_50; obj* x_51; obj* x_52;
|
||||
x_50 = lean::cnstr_get(x_33, 0);
|
||||
x_51 = lean::cnstr_get(x_33, 1);
|
||||
lean::inc(x_51);
|
||||
lean::dec(x_34);
|
||||
x_53 = lean::alloc_cnstr(1, 2, 0);
|
||||
lean::cnstr_set(x_53, 0, x_51);
|
||||
lean::cnstr_set(x_53, 1, x_52);
|
||||
return x_53;
|
||||
lean::inc(x_50);
|
||||
lean::dec(x_33);
|
||||
x_52 = lean::alloc_cnstr(1, 2, 0);
|
||||
lean::cnstr_set(x_52, 0, x_50);
|
||||
lean::cnstr_set(x_52, 1, x_51);
|
||||
return x_52;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
obj* x_53; obj* x_54; obj* x_55;
|
||||
lean::dec(x_6);
|
||||
lean::dec(x_1);
|
||||
x_53 = lean::cnstr_get(x_7, 2);
|
||||
lean::inc(x_53);
|
||||
lean::dec(x_7);
|
||||
lean::inc(x_53);
|
||||
x_54 = l_List_reverse___rarg(x_53);
|
||||
x_55 = l_List_mfor___main___at___private_init_lean_parser_module_4__testModuleParserAux___main___spec__5(x_54, x_4);
|
||||
if (lean::obj_tag(x_55) == 0)
|
||||
{
|
||||
uint8 x_56;
|
||||
x_56 = !lean::is_exclusive(x_55);
|
||||
if (x_56 == 0)
|
||||
{
|
||||
obj* x_57; uint8 x_58; uint8 x_59;
|
||||
x_57 = lean::cnstr_get(x_55, 0);
|
||||
lean::dec(x_57);
|
||||
x_58 = 0;
|
||||
x_59 = l_List_foldr___main___at_Lean_MessageLog_hasErrors___spec__1(x_58, x_53);
|
||||
lean::dec(x_53);
|
||||
if (x_59 == 0)
|
||||
{
|
||||
uint8 x_60; obj* x_61;
|
||||
x_60 = 1;
|
||||
x_61 = lean::box(x_60);
|
||||
lean::cnstr_set(x_55, 0, x_61);
|
||||
return x_55;
|
||||
}
|
||||
else
|
||||
{
|
||||
obj* x_62;
|
||||
x_62 = lean::box(x_58);
|
||||
lean::cnstr_set(x_55, 0, x_62);
|
||||
return x_55;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
obj* x_63; uint8 x_64; uint8 x_65;
|
||||
x_63 = lean::cnstr_get(x_55, 1);
|
||||
lean::inc(x_63);
|
||||
lean::dec(x_55);
|
||||
x_64 = 0;
|
||||
x_65 = l_List_foldr___main___at_Lean_MessageLog_hasErrors___spec__1(x_64, x_53);
|
||||
lean::dec(x_53);
|
||||
if (x_65 == 0)
|
||||
{
|
||||
uint8 x_66; obj* x_67; obj* x_68;
|
||||
x_66 = 1;
|
||||
x_67 = lean::box(x_66);
|
||||
x_68 = lean::alloc_cnstr(0, 2, 0);
|
||||
lean::cnstr_set(x_68, 0, x_67);
|
||||
lean::cnstr_set(x_68, 1, x_63);
|
||||
return x_68;
|
||||
}
|
||||
else
|
||||
{
|
||||
obj* x_69; obj* x_70;
|
||||
x_69 = lean::box(x_64);
|
||||
x_70 = lean::alloc_cnstr(0, 2, 0);
|
||||
lean::cnstr_set(x_70, 0, x_69);
|
||||
lean::cnstr_set(x_70, 1, x_63);
|
||||
return x_70;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
uint8 x_71;
|
||||
lean::dec(x_53);
|
||||
x_71 = !lean::is_exclusive(x_55);
|
||||
if (x_71 == 0)
|
||||
{
|
||||
return x_55;
|
||||
}
|
||||
else
|
||||
{
|
||||
obj* x_72; obj* x_73; obj* x_74;
|
||||
x_72 = lean::cnstr_get(x_55, 0);
|
||||
x_73 = lean::cnstr_get(x_55, 1);
|
||||
lean::inc(x_73);
|
||||
lean::inc(x_72);
|
||||
lean::dec(x_55);
|
||||
x_74 = lean::alloc_cnstr(1, 2, 0);
|
||||
lean::cnstr_set(x_74, 0, x_72);
|
||||
lean::cnstr_set(x_74, 1, x_73);
|
||||
return x_74;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
obj* l___private_init_lean_parser_module_4__testModuleParserAux___main___boxed(obj* x_1, obj* x_2, obj* x_3, obj* x_4) {
|
||||
_start:
|
||||
{
|
||||
uint8 x_5; obj* x_6;
|
||||
x_5 = lean::unbox(x_2);
|
||||
lean::dec(x_2);
|
||||
x_6 = l___private_init_lean_parser_module_4__testModuleParserAux___main(x_1, x_5, x_3, x_4);
|
||||
return x_6;
|
||||
}
|
||||
}
|
||||
obj* l___private_init_lean_parser_module_4__testModuleParserAux(obj* x_1, uint8 x_2, obj* x_3, obj* x_4) {
|
||||
_start:
|
||||
{
|
||||
obj* x_5;
|
||||
x_5 = l___private_init_lean_parser_module_4__testModuleParserAux___main(x_1, x_3, x_4);
|
||||
x_5 = l___private_init_lean_parser_module_4__testModuleParserAux___main(x_1, x_2, x_3, x_4);
|
||||
return x_5;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
22
src/stage0/init/lean/parser/parser.cpp
generated
22
src/stage0/init/lean/parser/parser.cpp
generated
|
|
@ -24078,10 +24078,13 @@ goto block_5;
|
|||
}
|
||||
else
|
||||
{
|
||||
obj* x_12;
|
||||
obj* x_12; obj* x_13;
|
||||
x_12 = lean::cnstr_get(x_9, 0);
|
||||
lean::inc(x_12);
|
||||
lean::dec(x_9);
|
||||
x_12 = lean::box(0);
|
||||
x_2 = x_12;
|
||||
x_13 = lean::alloc_cnstr(0, 1, 0);
|
||||
lean::cnstr_set(x_13, 0, x_12);
|
||||
x_2 = x_13;
|
||||
goto block_5;
|
||||
}
|
||||
block_5:
|
||||
|
|
@ -24089,6 +24092,7 @@ block_5:
|
|||
if (lean::obj_tag(x_2) == 0)
|
||||
{
|
||||
obj* x_3;
|
||||
lean::dec(x_2);
|
||||
x_3 = l_Lean_Parser_Trie_empty(lean::box(0));
|
||||
return x_3;
|
||||
}
|
||||
|
|
@ -26772,13 +26776,16 @@ goto block_10;
|
|||
}
|
||||
else
|
||||
{
|
||||
obj* x_16;
|
||||
lean::dec(x_12);
|
||||
obj* x_16; obj* x_17;
|
||||
lean::dec(x_4);
|
||||
lean::dec(x_3);
|
||||
lean::dec(x_1);
|
||||
x_16 = lean::box(0);
|
||||
x_6 = x_16;
|
||||
x_16 = lean::cnstr_get(x_12, 0);
|
||||
lean::inc(x_16);
|
||||
lean::dec(x_12);
|
||||
x_17 = lean::alloc_cnstr(0, 1, 0);
|
||||
lean::cnstr_set(x_17, 0, x_16);
|
||||
x_6 = x_17;
|
||||
goto block_10;
|
||||
}
|
||||
block_10:
|
||||
|
|
@ -26786,6 +26793,7 @@ block_10:
|
|||
if (lean::obj_tag(x_6) == 0)
|
||||
{
|
||||
obj* x_7; obj* x_8;
|
||||
lean::dec(x_6);
|
||||
x_7 = l_Lean_Parser_runBuiltinParserUnsafe___closed__1;
|
||||
x_8 = l_Lean_Parser_ParserState_mkError(x_5, x_7);
|
||||
return x_8;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue