* minimal CPS program?
@ 2018-05-22 3:25 Matt Wette
2018-05-23 2:48 ` Matt Wette
0 siblings, 1 reply; 2+ messages in thread
From: Matt Wette @ 2018-05-22 3:25 UTC (permalink / raw)
To: guile-user
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)>)
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: minimal CPS program?
2018-05-22 3:25 minimal CPS program? Matt Wette
@ 2018-05-23 2:48 ` Matt Wette
0 siblings, 0 replies; 2+ messages in thread
From: Matt Wette @ 2018-05-23 2:48 UTC (permalink / raw)
To: guile-user
On 05/21/2018 08:25 PM, Matt Wette wrote:
> Hi All,
> I'm trying to compile a minimal cps program.
Here is something that compiles:
(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 ($values ()))))
(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))))))))
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-05-23 2:48 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-05-22 3:25 minimal CPS program? Matt Wette
2018-05-23 2:48 ` Matt Wette
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).