Update
This commit is contained in:
parent
fcd1561f7b
commit
214f416100
3 changed files with 41 additions and 3 deletions
|
@ -17,8 +17,8 @@ astep (suc c) e = suc $ astep c e
|
||||||
astep (` id) e = lookup e id
|
astep (` id) e = lookup e id
|
||||||
astep (ƛ body) e = clo body e
|
astep (ƛ body) e = clo body e
|
||||||
|
|
||||||
inject : (A : Type) → Exp ∅ A → State A
|
inject : {A : Type} → Exp ∅ A → State A
|
||||||
inject A C = mkState A ∅ C ∅ halt
|
inject {A} C = mkState A ∅ C ∅ halt
|
||||||
|
|
||||||
step : ∀ {Tω : Type} → State Tω → StepResult Tω
|
step : ∀ {Tω : Type} → State Tω → StepResult Tω
|
||||||
step (mkState Tc Γ (case c cz cs) E K) with ⦅ astep c E , astep cs E ⦆
|
step (mkState Tc Γ (case c cz cs) E K) with ⦅ astep c E , astep cs E ⦆
|
||||||
|
@ -33,7 +33,7 @@ step (mkState Tc Γ (atomic x) E K) with K
|
||||||
... | halt = done $ astep x E
|
... | halt = done $ astep x E
|
||||||
... | kont l = part $ do-kont l $ astep x E
|
... | kont l = part $ do-kont l $ astep x E
|
||||||
step (mkState Tc Γ (call/cc C) E K) =
|
step (mkState Tc Γ (call/cc C) E K) =
|
||||||
part $ mkState ({! !} k⇒ {! !}) Γ {! !} {! !} {! !}
|
part $ mkState (({! !} ⇒ {! !}) k⇒ {! !}) Γ {! !} {! !} {! !}
|
||||||
|
|
||||||
-- 3 + (call/cc k . k 2 + k 4)
|
-- 3 + (call/cc k . k 2 + k 4)
|
||||||
-- (k . k 2 + k 4) (\x . 3 + x)
|
-- (k . k 2 + k 4) (\x . 3 + x)
|
||||||
|
|
21
src/Project/Syntax.agda
Normal file
21
src/Project/Syntax.agda
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
module Project.Syntax where
|
||||||
|
|
||||||
|
open import Data.String using (String)
|
||||||
|
|
||||||
|
data Type : Set where
|
||||||
|
|
||||||
|
data Term : Set where
|
||||||
|
-- Natural numbers
|
||||||
|
zero : Term
|
||||||
|
suc : Term → Term
|
||||||
|
|
||||||
|
-- Functions
|
||||||
|
`_ : String → Term
|
||||||
|
ƛ_⇒_ : String → Term → Term
|
||||||
|
|
||||||
|
-- Call/cc
|
||||||
|
call/cc : Term → Term
|
||||||
|
|
||||||
|
data TermEnv : Set where
|
||||||
|
∅ : TermEnv
|
||||||
|
_[_∶_] : TermEnv → String → Type → TermEnv
|
17
src/Project/notes.txt
Normal file
17
src/Project/notes.txt
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
-- Assume double is a language construct that doubles a number
|
||||||
|
|
||||||
|
State {
|
||||||
|
Tc = ?
|
||||||
|
Ctx = nil
|
||||||
|
C = double (call/cc k . suc k)
|
||||||
|
E = []
|
||||||
|
K = halt
|
||||||
|
}
|
||||||
|
|
||||||
|
State {
|
||||||
|
Tc = ?
|
||||||
|
Ctx = nil
|
||||||
|
C = x * 2
|
||||||
|
E = [x = call/cc k . suc k]
|
||||||
|
K = halt
|
||||||
|
}
|
Loading…
Reference in a new issue