diff options
Diffstat (limited to 'csc/ir2.csc')
| -rw-r--r-- | csc/ir2.csc | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/csc/ir2.csc b/csc/ir2.csc index 6ab0705..bd2c1b6 100644 --- a/csc/ir2.csc +++ b/csc/ir2.csc @@ -3,12 +3,17 @@ atom-continuation atom-expression atom? + branch-atom + branch-false + branch-true + branch? ir2=? kargs-expression kargs-refs kargs? ktail? make-atom + make-branch make-kargs make-ktail make-update @@ -96,6 +101,17 @@ (continuation update-continuation)) + ; Evaluates the given atom. + ; If it is true, continue with continuation true. + ; If false, continue with continuation false. + (define-record-type <branch> + (make-branch atom true false) + branch? + (atom branch-atom) + (true branch-true) + (false branch-false)) + + ; CPS continuations. @@ -134,6 +150,10 @@ return #f finally (return #t)) (ir2=? (kargs-expression x) (kargs-expression y))))) + ((and (branch? x) (branch? y)) + (and (ir1=? (branch-atom x) (branch-atom y)) + (= (branch-true x) (branch-true y)) + (= (branch-false x) (branch-false y)))) (else #f))) |
