Kind/book/Kind.Book.parser.kind2
Victor Taelin 85ad65b026 use-notation
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.
2024-03-08 17:39:37 -03:00

94 lines
2.5 KiB
Plaintext

Kind.Book.parser
: (Parser Kind.Book)
= (Parser.bind
Bool
Kind.Book
Parser.is_eof
λis_eof
use P = λx (Parser Kind.Book)
use true = (Parser.pure Kind.Book (String.Map.new Kind.Term))
use false = (Parser.bind
String
Kind.Book
Parser.name
λnam
(Parser.bind
Bool
Kind.Book
(Parser.skip Bool (Parser.test ":"))
λann
use P = λx (Parser Kind.Book)
use true = (Parser.bind
Unit
Kind.Book
(Parser.text ":")
λ_
(Parser.bind
Kind.PreTerm
Kind.Book
Kind.Term.parser
λtyp
(Parser.bind
Unit
Kind.Book
(Parser.text "=")
λ_
(Parser.bind
Kind.PreTerm
Kind.Book
Kind.Term.parser
λval
(Parser.bind
Kind.Book
Kind.Book
Kind.Book.parser
λbook
(Parser.pure
Kind.Book
(String.Map.set
Kind.Term
nam
(Kind.ann
(val (List.nil Kind.Binder))
(typ (List.nil Kind.Binder))
)
book
)
)
)
)
)
)
)
use false = (Parser.bind
Unit
Kind.Book
(Parser.text "=")
λ_
(Parser.bind
Kind.PreTerm
Kind.Book
Kind.Term.parser
λval
(Parser.bind
Kind.Book
Kind.Book
Kind.Book.parser
λbook
(Parser.pure
Kind.Book
(String.Map.set
Kind.Term
nam
(val (List.nil Kind.Binder))
book
)
)
)
)
)
(~ann P true false)
)
)
(~is_eof P true false)
)