add let
to frontend syntax
This commit is contained in:
parent
59e7a457a6
commit
68d8019f00
6 changed files with 55 additions and 0 deletions
|
@ -108,6 +108,13 @@ tests = "lexer" :- [
|
|||
lexes "case0" [Reserved "case0"],
|
||||
lexes "case##" [Name "case##"],
|
||||
|
||||
lexes "let" [Reserved "let"],
|
||||
lexes "letω" [Reserved "letω"],
|
||||
lexes "let#" [Reserved "letω"],
|
||||
lexes "let1" [Reserved "let1"],
|
||||
lexes "let0" [Reserved "let0"],
|
||||
lexes "let##" [Name "let##"],
|
||||
|
||||
lexes "_" [Reserved "_"],
|
||||
lexes "_a" [Name "_a"],
|
||||
lexes "a_" [Name "a_"],
|
||||
|
|
|
@ -411,6 +411,30 @@ tests = "parser" :- [
|
|||
(V "x" {}) _)
|
||||
],
|
||||
|
||||
"let" :- [
|
||||
parseMatch term "let x = y in z"
|
||||
`(Let (PQ One _, PV "x" {}, V "y" {}) (V "z" {}) _),
|
||||
parseMatch term "let0 x = y in z"
|
||||
`(Let (PQ Zero _, PV "x" {}, V "y" {}) (V "z" {}) _),
|
||||
parseMatch term "let1 x = y in z"
|
||||
`(Let (PQ One _, PV "x" {}, V "y" {}) (V "z" {}) _),
|
||||
parseMatch term "letω x = y in z"
|
||||
`(Let (PQ Any _, PV "x" {}, V "y" {}) (V "z" {}) _),
|
||||
parseMatch term "let x = y1 y2 in z1 z2"
|
||||
`(Let (PQ One _, PV "x" {},
|
||||
(App (V "y1" {}) (V "y2" {}) _))
|
||||
(App (V "z1" {}) (V "z2" {}) _) _),
|
||||
parseMatch term "let x = a in let y = b in z"
|
||||
`(Let (PQ One _, PV "x" {}, V "a" {})
|
||||
(Let (PQ One _, PV "y" {}, V "b" {}) (V "z" {}) _) _),
|
||||
parseMatch term "let x = y in z ∷ Z"
|
||||
`(Let (PQ One _, PV "x" {}, V "y" {})
|
||||
(Ann (V "z" {}) (V "Z" {}) _) _),
|
||||
parseMatch term "let x = y in z₁ ≡ z₂ : Z"
|
||||
`(Let (PQ One _, PV "x" {}, V "y" {})
|
||||
(Eq (Unused _, V "Z" {}) (V "z₁" {}) (V "z₂" {}) _) _)
|
||||
],
|
||||
|
||||
"definitions" :-
|
||||
let definition = flip definition [] in [
|
||||
parseMatch definition "defω x : {a} × {b} = ('a, 'b);"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue