Matt Wette
2018-05-22 03:25:43 UTC
Hi All,
I'm trying to compile a minimal cps program. Can anyone provide this?
Here is what I have
(define (doit)
(parameterize ((label-counter 0)
(var-counter 0))
(with-cps empty-intmap
(letv init)
(letk kinit ,#f)
(letk ktail ($ktail))
(letk kbody ($kargs () () ($continue ktail #f ($const 1))))
(letk kclause ($kclause ('() '() #f '() #f) kbody #f))
($ ((lambda (cps)
(let ((init (build-cont ($kfun #f '() init ktail kclause))))
(with-cps (persistent-intmap (intmap-replace! cps kinit init))
kinit))))))))
(compile (doit) #:from 'cps #:to 'bytecode)
which generates
language/cps/types.scm:1646:7: In procedure visit-cont:
Throw to key `match-error' with args `("match" "no matching pattern" #<cps (ktail)>)'.
The cps (intmap) is
(0 . #<cps (kfun () 0 1 3)>)
(1 . #<cps (ktail)>)
(2 . #<cps (kargs () () (continue 1 (const 1)))>)
(3 . #<cps (kclause (() () #f () #f) 2)>)
I'm trying to compile a minimal cps program. Can anyone provide this?
Here is what I have
(define (doit)
(parameterize ((label-counter 0)
(var-counter 0))
(with-cps empty-intmap
(letv init)
(letk kinit ,#f)
(letk ktail ($ktail))
(letk kbody ($kargs () () ($continue ktail #f ($const 1))))
(letk kclause ($kclause ('() '() #f '() #f) kbody #f))
($ ((lambda (cps)
(let ((init (build-cont ($kfun #f '() init ktail kclause))))
(with-cps (persistent-intmap (intmap-replace! cps kinit init))
kinit))))))))
(compile (doit) #:from 'cps #:to 'bytecode)
which generates
language/cps/types.scm:1646:7: In procedure visit-cont:
Throw to key `match-error' with args `("match" "no matching pattern" #<cps (ktail)>)'.
The cps (intmap) is
(0 . #<cps (kfun () 0 1 3)>)
(1 . #<cps (ktail)>)
(2 . #<cps (kargs () () (continue 1 (const 1)))>)
(3 . #<cps (kclause (() () #f () #f) 2)>)