branch
This commit is contained in:
parent
2d006f8272
commit
4be57c1e37
|
@ -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))
|
||||
|
|
|
@ -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) '())))
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user