diff --git a/bootstrapped-primitives.rkt b/bootstrapped-primitives.rkt index 34c6545..9a3cc43 100644 --- a/bootstrapped-primitives.rkt +++ b/bootstrapped-primitives.rkt @@ -68,9 +68,7 @@ (define (make-bootstrapped-primitive-code name src) (parameterize ([current-defined-name name]) (append - (compile (parse src) (make-PrimitivesReference name) next-linkage) - ;; Remove the prefix after the Primitives assignment. - `(,(make-PopEnvironment 1 0))))) + (compile (parse src) (make-PrimitivesReference name) next-linkage)))) diff --git a/compile.rkt b/compile.rkt index cebbf94..3d820ad 100644 --- a/compile.rkt +++ b/compile.rkt @@ -24,16 +24,18 @@ (let ([after-lam-bodies (make-label 'afterLamBodies)] [before-pop-prompt (make-label 'beforePopPrompt)]) (statements - (append-instruction-sequences (make-instruction-sequence - `(,(make-GotoStatement (make-Label after-lam-bodies)))) - (compile-lambda-bodies (collect-all-lams exp)) - after-lam-bodies - - (make-instruction-sequence - `(,(make-PushControlFrame/Prompt default-continuation-prompt-tag - before-pop-prompt))) - (compile exp '() target prompt-linkage) - before-pop-prompt)))) + (append-instruction-sequences + + (make-instruction-sequence + `(,(make-GotoStatement (make-Label after-lam-bodies)))) + (compile-lambda-bodies (collect-all-lams exp)) + after-lam-bodies + + (make-instruction-sequence + `(,(make-PushControlFrame/Prompt default-continuation-prompt-tag + before-pop-prompt))) + (compile exp '() target prompt-linkage) + before-pop-prompt)))) (define-struct: lam+cenv ([lam : Lam] [cenv : CompileTimeEnvironment])) diff --git a/simulator-primitives.rkt b/simulator-primitives.rkt index ee6ad13..1d7dc7f 100644 --- a/simulator-primitives.rkt +++ b/simulator-primitives.rkt @@ -119,6 +119,10 @@ (apply newline args) the-void-value)) +(define my-vector-set! (lambda args + (apply vector-set! args) + the-void-value)) + (define lookup-primitive (make-lookup #:functions (+ - * / = < <= > >= sub1 @@ -156,7 +160,7 @@ (my-set-box! set-box!) vector - vector-set! + (my-vector-set! vector-set!) vector-ref (my-vector->list vector->list) (my-list->vector list->vector) diff --git a/test-conform.rkt b/test-conform.rkt index c581a32..2933ec7 100644 --- a/test-conform.rkt +++ b/test-conform.rkt @@ -51,12 +51,12 @@ (begin (printf "Running... \n") (let*-values([(a-machine num-steps) - (run (new-machine (run-compiler code)) options ...)] + (run (new-machine (run-compiler code) #t) options ...)] [(actual) (machine-val a-machine)]) (printf "ok. ~s steps.\n\n" num-steps)))))])) (test (read (open-input-file "tests/conform/program0.sch")) (port->string (open-input-file "tests/conform/expected0.txt")) - ;#:debug? #t + ;;#:debug? #t )