Parsing updates for unicode
- Allow unicode characters in indents and operators - Show lexing errors
This commit is contained in:
40
newt/Combinatory.newt
Normal file
40
newt/Combinatory.newt
Normal file
@@ -0,0 +1,40 @@
|
||||
module Combinatory
|
||||
|
||||
data Unit : U where
|
||||
MkUnit : Unit
|
||||
|
||||
infixr 7 _::_
|
||||
data List : U -> U where
|
||||
Nil : {A : U} -> List A
|
||||
_::_ : {A : U} -> A -> List A -> List A
|
||||
|
||||
-- prj/menagerie/papers/combinatory
|
||||
|
||||
infixr 6 _~>_
|
||||
data Type : U where
|
||||
ι : Type
|
||||
_~>_ : Type -> Type -> Type
|
||||
|
||||
A : U
|
||||
A = Unit
|
||||
|
||||
Val : Type -> U
|
||||
Val ι = A
|
||||
Val (x ~> y) = Val x -> Val y
|
||||
|
||||
Ctx : U
|
||||
Ctx = List Type
|
||||
|
||||
data Ref : Type -> Ctx -> U where
|
||||
Z : {σ : Type} {Γ : Ctx} -> Ref σ (σ :: Γ)
|
||||
S : {σ τ : Type} {Γ : Ctx} -> Ref σ Γ -> Ref σ (τ :: Γ)
|
||||
|
||||
data Term : Ctx -> Type -> U where
|
||||
App : {Γ : Ctx} {σ τ : Type} -> Term Γ (σ ~> τ) -> Term Γ σ -> Term Γ τ
|
||||
Lam : {Γ : Ctx} {σ τ : Type} -> Term (σ :: Γ) τ -> Term Γ (σ ~> τ)
|
||||
Var : {Γ : Ctx} {σ : Type} -> Ref σ Γ → Term Γ σ
|
||||
|
||||
-- FIXME, I'm not getting an error for Nil, but it's shadowing Nil
|
||||
data Env : Ctx -> U where
|
||||
ENil : Env Nil
|
||||
ECons : {Γ : Ctx} {σ : Type} → Val σ → Env Γ → Env (σ :: Γ)
|
||||
@@ -17,6 +17,7 @@ data Either : U -> U -> U where
|
||||
|
||||
infixr 0 _$_
|
||||
|
||||
-- Currently very noisy in generated code
|
||||
_$_ : {a b : U} -> (a -> b) -> a -> b
|
||||
f $ a = f a
|
||||
|
||||
|
||||
Reference in New Issue
Block a user