aboutsummaryrefslogtreecommitdiffstats
path: root/csc/cps.csc
blob: bd4f0885824203b4043f68dc17422413c2e1f555 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
(define-library (csc cps)
  (export
    ir1->ir2)
  (import (only (csc ir1)
            make-constant
            constant?
            lexical-ref?
            library-ref?)
          (only (csc ir2)
            make-atom
            make-tail)
          (scheme base))
  (begin


    (define (to-cps expr continuation)
      (cond
        ((or (constant? expr)
             (lexical-ref? expr)
             (library-ref? expr))
          (make-atom expr continuation))
        (else (error "unexpected type in to-cps" expr))))


    (define (ir1->ir2 program)
      (to-cps program (make-tail)))))