debugging let

This commit is contained in:
Danny Yoo 2011-03-11 14:45:37 -05:00
parent de41b4f379
commit 5de82cdecf
2 changed files with 19 additions and 3 deletions

View File

@ -151,10 +151,12 @@
[rhss (let-rhss exp)]
[body (let-body exp)])
(cond
[(= 0 (length vars))
(parse `(begin ,@body))]
[(= 1 (length vars))
(make-Let1 (car vars)
(parse (car rhss))
(parse `(begin ,body)))]
(parse `(begin ,@body)))]
[else
(error 'parse-let "not supported yet")])))
@ -193,4 +195,4 @@
;; let -> (listof expr)
(define (let-body exp)
(caddr exp))
(cddr exp))

View File

@ -482,13 +482,27 @@
(sum-integers 1 10)))
(list 3025 55))
(test (let () 5) 5)
(test (let* ([x 3]
[y 4]
[z 17])
(+ x y z))
24
24)
(test (list (let* ([x 3]
[y (+ x 1)]
[z (+ x y)])
(list x y z))
(let* ([x 17]
[y (+ x 1)]
[z (+ x y)])
(list x y z)))
(list (list 3 4 7)
(list 17 18 35))
#:debug? #t)
;(simulate (compile (parse '42) 'val 'next))