mirror of
https://github.com/HigherOrderCO/Kind.git
synced 2024-09-11 20:40:38 +03:00
85ad65b026
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.
28 lines
912 B
Plaintext
28 lines
912 B
Plaintext
Parser.until.go
|
|
: ∀(A: *)
|
|
∀(until: (Parser Bool))
|
|
∀(parse: (Parser A))
|
|
∀(terms: (List.Concatenator A))
|
|
(Parser (List.Concatenator A))
|
|
= λA λuntil λparse λterms λcode
|
|
use P = λx (Parser.Result (List.Concatenator A))
|
|
use done = λcode λstop
|
|
use P = λx
|
|
∀(code: String) (Parser.Result (List.Concatenator A))
|
|
use true = λcode
|
|
(Parser.Result.done (List.Concatenator A) code terms)
|
|
use false = λcode
|
|
use P = λx (Parser.Result (List.Concatenator A))
|
|
use done = λcode λvalue
|
|
(Parser.until.go
|
|
A
|
|
until
|
|
parse
|
|
λx (terms (List.cons A value x))
|
|
code
|
|
)
|
|
use fail = λerror (Parser.Result.fail (List.Concatenator A) error)
|
|
(~(parse code) P done fail)
|
|
(~stop P true false code)
|
|
use fail = λerror (Parser.Result.fail (List.Concatenator A) error)
|
|
(~(until code) P done fail) |