From 074be88089bc94a7324886a7cc4c553fd3c39432 Mon Sep 17 00:00:00 2001 From: dyoo Date: Thu, 31 Mar 2011 14:42:52 -0400 Subject: [PATCH] still debugging --- compile.rkt | 15 +++++---------- test-compiler.rkt | 30 +++++++++++++++++++++++++++++- 2 files changed, 34 insertions(+), 11 deletions(-) diff --git a/compile.rkt b/compile.rkt index fb1d9d0..ad57e54 100644 --- a/compile.rkt +++ b/compile.rkt @@ -478,11 +478,9 @@ [(operand-knowledge) (append (map (lambda: ([arg : Expression]) - (printf "looking up ~s in ~s\n" arg extended-cenv) (extract-static-knowledge arg extended-cenv)) constant-operands) (map (lambda: ([arg : Expression]) - (printf "looking up ~s in ~s\n" arg extended-cenv) (extract-static-knowledge arg extended-cenv)) rest-operands))] @@ -527,19 +525,16 @@ (end-with-linkage linkage cenv (append-instruction-sequences - stack-pushing-code rest-operand-code - (make-instruction-sequence `(,(make-AssignPrimOpStatement target - (make-CallKernelPrimitiveProcedure kernel-op - (append constant-operand-poss - rest-operand-poss) - expected-operand-types - typechecks?)))) - + (make-CallKernelPrimitiveProcedure + kernel-op + (append constant-operand-poss rest-operand-poss) + expected-operand-types + typechecks?)))) stack-popping-code)))) diff --git a/test-compiler.rkt b/test-compiler.rkt index 8b68308..a056a13 100644 --- a/test-compiler.rkt +++ b/test-compiler.rkt @@ -271,7 +271,35 @@ (tak (- z 1) x y)))) (tak 18 12 6)) 7) - + +(test '((let* ([x 42] + [f (lambda () x)]) + f)) + 42) + +(test '((let* ([x 42] + [y 43] + [f (lambda () (list x y))]) + f)) + (list 42 43)) + +(test '(begin (define (m f l) + (if (null? l) + l + (cons (f (car l)) + (m f (cdr l))))) + (m (lambda (x) (add1 x)) '(2 3 4 5))) + '(3 4 5 6)) + + +(test '(+ (+ 3 4) + 6) + (+ 3 4 6)) + +(test '(+ (+ 3 (+ 4 5)) + 6) + (+ 3 4 5 6)) + ;; deriv (test '(begin (define (deriv-aux a) (list '/ (deriv a) a))