allow multiple names in a binder
e.g. "(x y : ℕ) × plus x y ≡ 10 : ℕ" fixes #2
This commit is contained in:
parent
b4a8438434
commit
3f06e8d68b
8 changed files with 49 additions and 50 deletions
|
@ -242,19 +242,20 @@ mutual
|
|||
bindTerm : Grammar True PTerm
|
||||
bindTerm = pi <|> sigma
|
||||
where
|
||||
binderHead = parens {commit = False} [|MkPair bname (resC ":" *> term)|]
|
||||
binderHead =
|
||||
parens {commit = False} [|MkPair (some bname) (resC ":" *> term)|]
|
||||
|
||||
pi, sigma : Grammar True PTerm
|
||||
pi = [|makePi (qty <* res ".") domain (resC "→" *> term)|]
|
||||
where
|
||||
makePi : Qty -> (BName, PTerm) -> PTerm -> PTerm
|
||||
makePi q (x, s) t = Pi q x s t
|
||||
domain = binderHead <|> [|(Nothing,) aTerm|]
|
||||
makePi : Qty -> (List1 BName, PTerm) -> PTerm -> PTerm
|
||||
makePi q (xs, s) t = foldr (\x => Pi q x s) t xs
|
||||
domain = binderHead <|> [|(Nothing ::: [],) aTerm|]
|
||||
|
||||
sigma = [|makeSigma binderHead (resC "×" *> annTerm)|]
|
||||
where
|
||||
makeSigma : (BName, PTerm) -> PTerm -> PTerm
|
||||
makeSigma (x, s) t = Sig x s t
|
||||
makeSigma : (List1 BName, PTerm) -> PTerm -> PTerm
|
||||
makeSigma (xs, s) t = foldr (\x => Sig x s) t xs
|
||||
|
||||
private covering
|
||||
annTerm : Grammar True PTerm
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue