mirror of
https://github.com/HigherOrderCO/Kind.git
synced 2024-09-11 15:56:12 +03:00
initially, I wanted Kind2 to be bootstrapped, but I'm facing difficulties, because pure hvm parser is still much slower than the typescript parser; a few seconds vs instant to parse the entire codebase. I think HVM2 will need to have proper immutable strings (i.e., nodes that expand as if they were cons-strings, but are stored as buffers) before it can have fast parsers. as such, I'm making the decision to NOT bootstrap it now. that is a tough decision becase, honestly, if we don't do it as soon as possible in the development process, it is very unlikely we'll ever do it. but the tech isn't ready for it, and we need to move forward, so, that's the only solution. as such, I'll be rewritting the typescript to Rust, and we'll have a very similar design to former Kind2, with Rust doing the parsing, IO and error reporting, and a checker.hvm1 / checker.hvm2 file doing the actual type-checking (and HOAS-based type-level evaluation). also, I believe we'll not even generate .hvm from a .kind bootstrap. while losing types is significant, being able to manually edit the HVM is very helpful to debugging, it simplifies and accelerates the development process and removes many complications that are bought by bootstrapping
99 lines
3.1 KiB
Plaintext
99 lines
3.1 KiB
Plaintext
Kind.all
|
|
: ∀(nam: String)
|
|
∀(inp: Kind.Term)
|
|
∀(bod: ∀(x: Kind.Term) Kind.Term)
|
|
Kind.Term
|
|
= λnam λinp λbod
|
|
~λP λall λlam λapp λann λslf λins λref λdef λset λu60 λnum λop2 λmat λtxt λhol λvar
|
|
(all nam inp bod)Kind.ann
|
|
: ∀(val: Kind.Term)
|
|
∀(typ: Kind.Term)
|
|
Kind.Term
|
|
= λval λtyp
|
|
~λP λall λlam λapp λann λslf λins λref λdef λset λu60 λnum λop2 λmat λtxt λhol λvar
|
|
(ann val typ)
|
|
Kind.app
|
|
: ∀(fun: Kind.Term)
|
|
∀(arg: Kind.Term)
|
|
Kind.Term
|
|
= λfun λarg
|
|
~λP λall λlam λapp λann λslf λins λref λdef λset λu60 λnum λop2 λmat λtxt λhol λvar
|
|
(app fun arg)
|
|
Kind.def
|
|
: ∀(nam: String)
|
|
∀(val: Kind.Term)
|
|
∀(bod: ∀(x: Kind.Term) Kind.Term)
|
|
Kind.Term
|
|
= λnam λval λbod
|
|
~λP λall λlam λapp λann λslf λins λref λdef λset λu60 λnum λop2 λmat λtxt λhol λvar
|
|
(def nam val bod)Kind.hol
|
|
: ∀(nam: String)
|
|
∀(ctx: (List Kind.Term))
|
|
Kind.Term
|
|
= λnam λctx
|
|
~λP λall λlam λapp λann λslf λins λref λdef λset λu60 λnum λop2 λmat λtxt λhol λvar
|
|
(hol nam ctx)Kind.ins
|
|
: ∀(val: Kind.Term)
|
|
Kind.Term
|
|
= λval
|
|
~λP λall λlam λapp λann λslf λins λref λdef λset λu60 λnum λop2 λmat λtxt λhol λvar
|
|
(ins val)Kind.lam
|
|
: ∀(nam: String)
|
|
∀(bod: ∀(x: Kind.Term) Kind.Term)
|
|
Kind.Term
|
|
= λnam λbod
|
|
~λP λall λlam λapp λann λslf λins λref λdef λset λu60 λnum λop2 λmat λtxt λhol λvar
|
|
(lam nam bod)
|
|
Kind.mat
|
|
: ∀(nam: String)
|
|
∀(x: Kind.Term)
|
|
∀(z: Kind.Term)
|
|
∀(s: ∀(x: Kind.Term) Kind.Term)
|
|
∀(p: ∀(x: Kind.Term) Kind.Term)
|
|
Kind.Term
|
|
= λnam λx λz λs λp
|
|
~λP λall λlam λapp λann λslf λins λref λdef λset λu60 λnum λop2 λmat λtxt λhol λvar
|
|
(mat nam x z s p)Kind.num
|
|
: ∀(val: #U60)
|
|
Kind.Term
|
|
= λval
|
|
~λP λall λlam λapp λann λslf λins λref λdef λset λu60 λnum λop2 λmat λtxt λhol λvar
|
|
(num val)Kind.op2
|
|
: ∀(opr: Kind.Oper)
|
|
∀(fst: Kind.Term)
|
|
∀(snd: Kind.Term)
|
|
Kind.Term
|
|
= λopr λfst λsnd
|
|
~λP λall λlam λapp λann λslf λins λref λdef λset λu60 λnum λop2 λmat λtxt λhol λvar
|
|
(op2 opr fst snd)Kind.ref
|
|
: ∀(nam: String)
|
|
∀(val: Kind.Term)
|
|
Kind.Term
|
|
= λnam λval
|
|
~λP λall λlam λapp λann λslf λins λref λdef λset λu60 λnum λop2 λmat λtxt λhol λvar
|
|
(ref nam val)Kind.set
|
|
: Kind.Term
|
|
= ~λP λall λlam λapp λann λslf λins λref λdef λset λu60 λnum λop2 λmat λtxt λhol λvar
|
|
(set)
|
|
Kind.slf
|
|
: ∀(nam: String)
|
|
∀(bod: ∀(x: Kind.Term) Kind.Term)
|
|
Kind.Term
|
|
= λnam λbod
|
|
~λP λall λlam λapp λann λslf λins λref λdef λset λu60 λnum λop2 λmat λtxt λhol λvar
|
|
(slf nam bod)Kind.txt
|
|
: ∀(lit: Kind.Text)
|
|
Kind.Term
|
|
= λlit
|
|
~λP λall λlam λapp λann λslf λins λref λdef λset λu60 λnum λop2 λmat λtxt λhol λvar
|
|
(txt lit)Kind.u60
|
|
: Kind.Term
|
|
= ~λP λall λlam λapp λann λslf λins λref λdef λset λu60 λnum λop2 λmat λtxt λhol λvar
|
|
u60
|
|
Kind.var
|
|
: ∀(nam: String)
|
|
∀(idx: Nat)
|
|
Kind.Term
|
|
= λnam λidx
|
|
~λP λall λlam λapp λann λslf λins λref λdef λset λu60 λnum λop2 λmat λtxt λhol λvar
|
|
(var nam idx) |