diff options
| author | Rose Hogenson <rhogenson@posteo.net> | 2022-06-25 19:32:04 -0700 |
|---|---|---|
| committer | Rose Hogenson <rhogenson@posteo.net> | 2022-06-25 19:32:04 -0700 |
| commit | 05463502db73ab9a5ac23e1f598e838fbe14b3f8 (patch) | |
| tree | b7ae8cb2f7da272db8c0006dd5e0d5400a702743 /csc/ir2.csc | |
| parent | Continue work on continuation passing style. (diff) | |
| download | chromatopelma-05463502db73ab9a5ac23e1f598e838fbe14b3f8.tar.zst | |
More CPS.
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))) |
