diff --git a/simulator.rkt b/simulator.rkt index 5069b8c..a18551b 100644 --- a/simulator.rkt +++ b/simulator.rkt @@ -197,7 +197,6 @@ val-update] [(EnvLexicalReference? t) (lambda: ([m : machine] [v : SlotValue]) - (printf "Setting env[~a] to ~s\n" (EnvLexicalReference-depth t) v) (env-mutate m (EnvLexicalReference-depth t) v))])) diff --git a/test-compiler.rkt b/test-compiler.rkt index bc3815c..8922e4f 100644 --- a/test-compiler.rkt +++ b/test-compiler.rkt @@ -24,7 +24,10 @@ (unless (equal? actual exp) (raise-syntax-error #f (format "Expected ~s, got ~s" exp actual) #'stx)) - (printf "ok. ~s steps\n\n" num-steps)))))])) + (unless (= (length (machine-env a-machine)) 1) + (raise-syntax-error #f (format "Stack is not back to the prefix as expected!") + #'stx)) + (printf "ok. ~s steps.\n\n" num-steps)))))])) ;; test, and expect an error (define-syntax (test/exn stx) @@ -116,6 +119,17 @@ 81) +;; Slightly crazy expression +(test (begin (define (f x) + (* x x)) + (define (g x) + (* x x x)) + (- (g (f (+ (g 3) + (f 3)))) + 1)) + 2176782335) + + ;; Simple application (test ((lambda (x) x) 42) 42)