mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-04-30 11:50:28 +02:00
Change program type representation
This commit is contained in:
parent
f0537e39ee
commit
a7b2dfa581
4 changed files with 42 additions and 30 deletions
|
@ -118,15 +118,23 @@
|
|||
(define (compile-exp exp)
|
||||
;; TODO: handle ids for js
|
||||
(match exp
|
||||
(($ il:program (and entry ($ il:var name _)) body)
|
||||
(($ il:program ((name . fun) (names . funs) ...))
|
||||
(let ((entry-call
|
||||
(make-return
|
||||
(make-call (compile-id name)
|
||||
(list
|
||||
(make-id "undefined")
|
||||
(make-refine *scheme* (make-const "initial_cont")))))))
|
||||
(make-call (make-function '() (append (map compile-exp body)
|
||||
(list (compile-exp entry) entry-call)))
|
||||
(make-call (make-function
|
||||
'()
|
||||
(append
|
||||
(map (lambda (id f)
|
||||
(make-var (rename-id id)
|
||||
(compile-exp f)))
|
||||
(cons name names)
|
||||
(cons fun funs))
|
||||
|
||||
(list entry-call)))
|
||||
'())))
|
||||
|
||||
(($ il:continuation params body)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue