still debugging
This commit is contained in:
parent
73015f4116
commit
074be88089
15
compile.rkt
15
compile.rkt
|
@ -478,11 +478,9 @@
|
||||||
|
|
||||||
[(operand-knowledge)
|
[(operand-knowledge)
|
||||||
(append (map (lambda: ([arg : Expression])
|
(append (map (lambda: ([arg : Expression])
|
||||||
(printf "looking up ~s in ~s\n" arg extended-cenv)
|
|
||||||
(extract-static-knowledge arg extended-cenv))
|
(extract-static-knowledge arg extended-cenv))
|
||||||
constant-operands)
|
constant-operands)
|
||||||
(map (lambda: ([arg : Expression])
|
(map (lambda: ([arg : Expression])
|
||||||
(printf "looking up ~s in ~s\n" arg extended-cenv)
|
|
||||||
(extract-static-knowledge arg extended-cenv))
|
(extract-static-knowledge arg extended-cenv))
|
||||||
rest-operands))]
|
rest-operands))]
|
||||||
|
|
||||||
|
@ -527,19 +525,16 @@
|
||||||
(end-with-linkage
|
(end-with-linkage
|
||||||
linkage cenv
|
linkage cenv
|
||||||
(append-instruction-sequences
|
(append-instruction-sequences
|
||||||
|
|
||||||
stack-pushing-code
|
stack-pushing-code
|
||||||
rest-operand-code
|
rest-operand-code
|
||||||
|
|
||||||
(make-instruction-sequence
|
(make-instruction-sequence
|
||||||
`(,(make-AssignPrimOpStatement
|
`(,(make-AssignPrimOpStatement
|
||||||
target
|
target
|
||||||
(make-CallKernelPrimitiveProcedure kernel-op
|
(make-CallKernelPrimitiveProcedure
|
||||||
(append constant-operand-poss
|
kernel-op
|
||||||
rest-operand-poss)
|
(append constant-operand-poss rest-operand-poss)
|
||||||
expected-operand-types
|
expected-operand-types
|
||||||
typechecks?))))
|
typechecks?))))
|
||||||
|
|
||||||
stack-popping-code))))
|
stack-popping-code))))
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -271,7 +271,35 @@
|
||||||
(tak (- z 1) x y))))
|
(tak (- z 1) x y))))
|
||||||
(tak 18 12 6))
|
(tak 18 12 6))
|
||||||
7)
|
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
|
;; deriv
|
||||||
(test '(begin (define (deriv-aux a) (list '/ (deriv a) a))
|
(test '(begin (define (deriv-aux a) (list '/ (deriv a) a))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user