trying to make call/cc work on the web
This commit is contained in:
parent
0c497bef5c
commit
b01bb3bc85
20
assemble.rkt
20
assemble.rkt
|
@ -120,6 +120,10 @@ EOF
|
||||||
[(ApplyPrimitiveProcedure? op)
|
[(ApplyPrimitiveProcedure? op)
|
||||||
(list (ApplyPrimitiveProcedure-label op))]
|
(list (ApplyPrimitiveProcedure-label op))]
|
||||||
[(GetControlStackLabel? op)
|
[(GetControlStackLabel? op)
|
||||||
|
empty]
|
||||||
|
[(CaptureEnvironment? op)
|
||||||
|
empty]
|
||||||
|
[(CaptureControl? op)
|
||||||
empty]))
|
empty]))
|
||||||
|
|
||||||
(: collect-primitive-command (PrimitiveCommand -> (Listof Symbol)))
|
(: collect-primitive-command (PrimitiveCommand -> (Listof Symbol)))
|
||||||
|
@ -132,6 +136,10 @@ EOF
|
||||||
[(ExtendEnvironment/Prefix!? op)
|
[(ExtendEnvironment/Prefix!? op)
|
||||||
empty]
|
empty]
|
||||||
[(InstallClosureValues!? op)
|
[(InstallClosureValues!? op)
|
||||||
|
empty]
|
||||||
|
[(RestoreEnvironment!? op)
|
||||||
|
empty]
|
||||||
|
[(RestoreControl!? op)
|
||||||
empty]))
|
empty]))
|
||||||
|
|
||||||
(unique/eq?
|
(unique/eq?
|
||||||
|
@ -337,7 +345,11 @@ EOF
|
||||||
(ApplyPrimitiveProcedure-label op))]
|
(ApplyPrimitiveProcedure-label op))]
|
||||||
|
|
||||||
[(GetControlStackLabel? op)
|
[(GetControlStackLabel? op)
|
||||||
(format "MACHINE.control[MACHINE.control.length-1].label")]))
|
(format "MACHINE.control[MACHINE.control.length-1].label")]
|
||||||
|
[(CaptureEnvironment? op)
|
||||||
|
(format "MACHINE.env.slice(0)")]
|
||||||
|
[(CaptureControl? op)
|
||||||
|
(format "MACHINE.control.slice(0)")]))
|
||||||
|
|
||||||
|
|
||||||
(: assemble-op-statement (PrimitiveCommand -> String))
|
(: assemble-op-statement (PrimitiveCommand -> String))
|
||||||
|
@ -366,7 +378,11 @@ EOF
|
||||||
",")))]
|
",")))]
|
||||||
|
|
||||||
[(InstallClosureValues!? op)
|
[(InstallClosureValues!? op)
|
||||||
"MACHINE.env.splice.apply(MACHINE.env, [MACHINE.env.length, 0].concat(MACHINE.proc.closedVals));"]))
|
"MACHINE.env.splice.apply(MACHINE.env, [MACHINE.env.length, 0].concat(MACHINE.proc.closedVals));"]
|
||||||
|
[(RestoreEnvironment!? op)
|
||||||
|
"MACHINE.env = MACHINE.env[MACHINE.env.length - 2].slice(0);"]
|
||||||
|
[(RestoreControl!? op)
|
||||||
|
"MACHINE.control = MACHINE.env[MACHINE.env.length - 1].slice(0);"]))
|
||||||
|
|
||||||
|
|
||||||
(: assemble-input (OpArg -> String))
|
(: assemble-input (OpArg -> String))
|
||||||
|
|
|
@ -13,7 +13,8 @@
|
||||||
compile-procedure-call
|
compile-procedure-call
|
||||||
append-instruction-sequences
|
append-instruction-sequences
|
||||||
|
|
||||||
call/cc-label)
|
call/cc-label
|
||||||
|
make-call/cc-code)
|
||||||
|
|
||||||
;(provide compile-top)
|
;(provide compile-top)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user