mirror of
https://github.com/HigherOrderCO/Kind.git
synced 2024-09-11 19:47:15 +03:00
Now, there are two local binders: let x = ... use x = ... The 'let' binder will create a local definition, type-check it, and assign a name to it. When compiled, it will create 'dup' nodes. The 'use' binder is just an alias. It will not bind a new variable, and, when compiled, will create inline copies. Also, for type-checking, it allows creating aliases that are definitionaly equal for the checker.
37 lines
1.1 KiB
Plaintext
37 lines
1.1 KiB
Plaintext
Parser.test
|
|
: ∀(test: String) (Parser Bool)
|
|
= λtest λcode
|
|
use P = λx ∀(code: String) (Parser.Result Bool)
|
|
use cons = λtest.head λtest.tail λcode
|
|
use P = λx (Parser.Result Bool)
|
|
use cons = λcode.head λcode.tail
|
|
use P = λx
|
|
∀(code.head: Char) ∀(code.tail: String)
|
|
(Parser.Result Bool)
|
|
use true = λcode.head λcode.tail
|
|
use P = λx (Parser.Result Bool)
|
|
use done = λcode λvalue
|
|
(Parser.Result.done
|
|
Bool
|
|
(String.cons code.head code)
|
|
value
|
|
)
|
|
use fail = λerror (Parser.Result.fail Bool error)
|
|
(~(Parser.test test.tail code.tail) P done fail)
|
|
use false = λcode.head λcode.tail
|
|
(Parser.Result.done
|
|
Bool
|
|
(String.cons code.head code.tail)
|
|
Bool.false
|
|
)
|
|
(~(Char.equal test.head code.head)
|
|
P
|
|
true
|
|
false
|
|
code.head
|
|
code.tail
|
|
)
|
|
use nil = (Parser.Result.done Bool String.nil Bool.false)
|
|
(~code P cons nil)
|
|
use nil = λcode (Parser.Result.done Bool code Bool.true)
|
|
(~test P cons nil code) |