This commit is contained in:
Michael Zhang 2021-12-08 02:30:29 -06:00
parent fcd1561f7b
commit 214f416100
Signed by: michael
GPG key ID: BDA47A31A3C8EE6B
3 changed files with 41 additions and 3 deletions

View file

@ -17,8 +17,8 @@ astep (suc c) e = suc $ astep c e
astep (` id) e = lookup e id
astep (ƛ body) e = clo body e
inject : (A : Type) Exp A State A
inject A C = mkState A C halt
inject : {A : Type} Exp A State A
inject {A} C = mkState A C halt
step : { : Type} State StepResult
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
... | kont l = part $ do-kont l $ astep x E
step (mkState Tc Γ (call/cc C) E K) =
part $ mkState ({! !} k⇒ {! !}) Γ {! !} {! !} {! !}
part $ mkState (({! !} {! !}) k⇒ {! !}) Γ {! !} {! !} {! !}
-- 3 + (call/cc k . k 2 + k 4)
-- (k . k 2 + k 4) (\x . 3 + x)

21
src/Project/Syntax.agda Normal file
View 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
View 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
}