From 05463502db73ab9a5ac23e1f598e838fbe14b3f8 Mon Sep 17 00:00:00 2001 From: Rose Hogenson Date: Sat, 25 Jun 2022 19:32:04 -0700 Subject: More CPS. --- csc/ir2.csc | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'csc/ir2.csc') 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 + (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))) -- cgit v1.3.1