mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-16 17:27:33 +02:00
WIP
This commit is contained in:
parent
cf2cb18ee5
commit
285f02158d
1 changed files with 13 additions and 0 deletions
|
@ -83,6 +83,7 @@
|
||||||
(error "unknown ast" ast))))
|
(error "unknown ast" ast))))
|
||||||
|
|
||||||
(define (cps-list asts inner)
|
(define (cps-list asts inner)
|
||||||
|
(trace:error `(cps-list ,asts ,inner))
|
||||||
(define (body x)
|
(define (body x)
|
||||||
(cps-list (cdr asts)
|
(cps-list (cdr asts)
|
||||||
(lambda (new-asts)
|
(lambda (new-asts)
|
||||||
|
@ -93,6 +94,10 @@
|
||||||
((or (const? (car asts))
|
((or (const? (car asts))
|
||||||
(ref? (car asts)))
|
(ref? (car asts)))
|
||||||
(body (car asts)))
|
(body (car asts)))
|
||||||
|
;; testing, probably won't work if prim calls into a cont
|
||||||
|
;((prim-call? (car asts))
|
||||||
|
; (body (car asts))) ;; TODO: does nothing, not what we want!
|
||||||
|
;; END testing
|
||||||
(else
|
(else
|
||||||
(let ((r (gensym 'r)))
|
(let ((r (gensym 'r)))
|
||||||
(cps (car asts)
|
(cps (car asts)
|
||||||
|
@ -133,3 +138,11 @@
|
||||||
(my-cps-convert
|
(my-cps-convert
|
||||||
'((define test (lambda (a$3 b$2 c$1) (write (cons (+ a$3 b$2 c$1) (- a$3 b$2 c$1))))) ((lambda () 0 (test 1 2 3))))
|
'((define test (lambda (a$3 b$2 c$1) (write (cons (+ a$3 b$2 c$1) (- a$3 b$2 c$1))))) ((lambda () 0 (test 1 2 3))))
|
||||||
))
|
))
|
||||||
|
|
||||||
|
(trace:error
|
||||||
|
(my-cps-convert
|
||||||
|
'((define test (lambda (a$3 b$2 c$1) (write
|
||||||
|
(cons
|
||||||
|
((lambda (x y z) (list x y z)) 1 2 3)
|
||||||
|
(cons (+ a$3 b$2 c$1) (- a$3 b$2 c$1))))) ((lambda () 0 (test 1 2 3))))
|
||||||
|
)))
|
||||||
|
|
Loading…
Add table
Reference in a new issue