This commit is contained in:
Danny Yoo 2011-05-09 16:38:32 -04:00
parent 2d006f8272
commit 4be57c1e37
2 changed files with 18 additions and 3 deletions

View File

@ -407,10 +407,13 @@
(make-Constant rand)]))
(define (parse-branch expr)
(error 'fixme))
(match expr
[(struct branch (test then else))
(make-Branch (parse-expr-seq-constant test)
(parse-expr-seq-constant then)
(parse-expr-seq-constant else))]))
(define (parse-with-cont-mark expr)
(error 'fixme))

View File

@ -123,8 +123,20 @@
(make-LocalRef 0 #f)))))
(check-equal? (run-my-parse #'(if (f) (g) (h)))
(make-Top (make-Prefix (list (make-GlobalBucket 'f)
(make-GlobalBucket 'g)
(make-GlobalBucket 'h)))
(make-Branch (make-App (make-ToplevelRef 0 0) '())
(make-App (make-ToplevelRef 0 1) '())
(make-App (make-ToplevelRef 0 2) '()))))
;; Another example where Racket's compiler is helping: constant propagation, dead code removal.
(check-equal? (run-my-parse #'(if 3 (g) (h)))
(make-Top (make-Prefix (list (make-GlobalBucket 'g)))
(make-App (make-ToplevelRef 0 0) '())))