add w types to parser
This commit is contained in:
parent
3cebc7b9b2
commit
7cf3fa8bae
5 changed files with 199 additions and 65 deletions
|
@ -168,6 +168,8 @@ tests = "parser" :- [
|
|||
(App (V "B" {}) (V "x" {}) _) _) _),
|
||||
parseMatch term "(x : A) → B x"
|
||||
`(Pi (PQ One _) (PV "x" _) (V "A" {}) (App (V "B" {}) (V "x" {}) _) _),
|
||||
parseFails term "(x : A) → (y : B x)",
|
||||
parseFails term "(x : A) → 1.(B x)",
|
||||
parseMatch term "1.A → B"
|
||||
`(Pi (PQ One _) (Unused _) (V "A" {}) (V "B" {}) _),
|
||||
parseMatch term "A → B"
|
||||
|
@ -249,6 +251,43 @@ tests = "parser" :- [
|
|||
parseFails term "(x,,y)"
|
||||
],
|
||||
|
||||
"w" :- [
|
||||
parseMatch term "(x : A) ⊲ B"
|
||||
`(W (PV "x" _) (V "A" {}) (V "B" {}) _),
|
||||
parseFails term "(x y : A) ⊲ B",
|
||||
parseFails term "1.(x : A) ⊲ B",
|
||||
parseMatch term "(x : A) ⊲ (y : B) ⊲ C"
|
||||
`(W (PV "x" _) (V "A" {})
|
||||
(W (PV "y" _) (V "B" {}) (V "C" {}) _) _),
|
||||
parseMatch term "A ⊲ B"
|
||||
`(W _ (V "A" {}) (V "B" {}) _),
|
||||
parseMatch term "A <| B"
|
||||
`(W _ (V "A" {}) (V "B" {}) _),
|
||||
parseFails term "A ⊲ (y : B)",
|
||||
parseMatch term "(x : A) ⊲ B x × C"
|
||||
`(W (PV "x" _) (V "A" {})
|
||||
(Sig _ (App (V "B" {}) (V "x" {}) _) (V "C" {}) _) _),
|
||||
parseMatch term "A ⊲ B → C"
|
||||
`(Pi _ _ (W _ (V "A" {}) (V "B" {}) _) (V "C" {}) _),
|
||||
parseMatch term "A → B ⊲ C"
|
||||
`(Pi _ _ (V "A" {}) (W _ (V "B" {}) (V "C" {}) _) _)
|
||||
],
|
||||
|
||||
"sup" :- [
|
||||
parseMatch term "s ⋄ t"
|
||||
`(Sup (V "s" {}) (V "t" {}) _),
|
||||
parseMatch term "s ⋄ t ⋄ u"
|
||||
`(Sup (V "s" {}) (Sup (V "t" {}) (V "u" {}) _) _),
|
||||
parseMatch term "s <> t"
|
||||
`(Sup (V "s" {}) (V "t" {}) _),
|
||||
parseMatch term "a b ⋄ c d"
|
||||
`(Sup (App (V "a" {}) (V "b" {}) _) (App (V "c" {}) (V "d" {}) _) _),
|
||||
parseMatch term "a ⋄ b ≡ a' ⋄ b' : (A ⊲ B)"
|
||||
`(Eq (_, W _ (V "A" {}) (V "B" {}) _)
|
||||
(Sup (V "a" {}) (V "b" {}) _)
|
||||
(Sup (V "a'" {}) (V "b'" {}) _) _)
|
||||
],
|
||||
|
||||
"equality type" :- [
|
||||
parseMatch term "Eq (i ⇒ A) s t"
|
||||
`(Eq (PV "i" _, V "A" {}) (V "s" {}) (V "t" {}) _),
|
||||
|
@ -396,8 +435,23 @@ tests = "parser" :- [
|
|||
parseMatch term "caseω n return ℕ of { succ _, ih ⇒ ih; zero ⇒ 0; }"
|
||||
`(Case (PQ Any _) (V "n" {}) (Unused _, Nat _)
|
||||
(CaseNat (Zero _) (Unused _, PQ One _, PV "ih" _, V "ih" {}) _) _),
|
||||
parseMatch term "caseω n return ℕ of { succ _, _ ⇒ ih; zero ⇒ 0; }"
|
||||
`(Case (PQ Any _) (V "n" {}) (Unused _, Nat _)
|
||||
(CaseNat (Zero _) (Unused _, PQ Zero _, Unused _, V "ih" {}) _) _),
|
||||
parseFails term "caseω n return A of { zero ⇒ a }",
|
||||
parseFails term "caseω n return ℕ of { succ ⇒ 5 }"
|
||||
parseFails term "caseω n return ℕ of { succ ⇒ 5 }",
|
||||
parseMatch term "case e return z ⇒ C of { a ⋄ b, ω.ih ⇒ u }"
|
||||
`(Case (PQ One _) (V "e" {}) (PV "z" _, V "C" {})
|
||||
(CaseW (PV "a" _) (PV "b" _) (PQ Any _, PV "ih" _) (V "u" {}) _) _),
|
||||
parseMatch term "case e return z ⇒ C of { a ⋄ b, ih ⇒ u }"
|
||||
`(Case (PQ One _) (V "e" {}) (PV "z" _, V "C" {})
|
||||
(CaseW (PV "a" _) (PV "b" _) (PQ One _, PV "ih" _) (V "u" {}) _) _),
|
||||
parseMatch term "case e return z ⇒ C of { a ⋄ b ⇒ u }"
|
||||
`(Case (PQ One _) (V "e" {}) (PV "z" _, V "C" {})
|
||||
(CaseW (PV "a" _) (PV "b" _) (PQ Zero _, Unused _) (V "u" {}) _) _),
|
||||
parseMatch term "case e return z ⇒ C of { a ⋄ b, _ ⇒ u }"
|
||||
`(Case (PQ One _) (V "e" {}) (PV "z" _, V "C" {})
|
||||
(CaseW (PV "a" _) (PV "b" _) (PQ Zero _, Unused _) (V "u" {}) _) _)
|
||||
],
|
||||
|
||||
"definitions" :- [
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue