mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-19 21:59:16 +02:00
WIP
This commit is contained in:
parent
59ce882138
commit
31b46ecd65
1 changed files with 27 additions and 25 deletions
42
cyclone.scm
42
cyclone.scm
|
@ -20,23 +20,23 @@
|
||||||
(scheme cyclone macros)
|
(scheme cyclone macros)
|
||||||
(scheme cyclone libraries))
|
(scheme cyclone libraries))
|
||||||
|
|
||||||
(cond-expand
|
;;(cond-expand
|
||||||
(chicken
|
;; (chicken
|
||||||
(define (Cyc-installation-dir . opt)
|
;; (define (Cyc-installation-dir . opt)
|
||||||
(if (equal? '(inc) opt)
|
;; (if (equal? '(inc) opt)
|
||||||
"/home/justin/Documents/cyclone/include"
|
;; "/home/justin/Documents/cyclone/include"
|
||||||
;; Ignore opt and always assume current dir for chicken, since it is just dev
|
;; ;; Ignore opt and always assume current dir for chicken, since it is just dev
|
||||||
"/home/justin/Documents/cyclone"))
|
;; "/home/justin/Documents/cyclone"))
|
||||||
(require-extension extras) ;; pretty-print
|
;; (require-extension extras) ;; pretty-print
|
||||||
(require-extension chicken-syntax) ;; when
|
;; (require-extension chicken-syntax) ;; when
|
||||||
(require-extension srfi-1) ;; every
|
;; (require-extension srfi-1) ;; every
|
||||||
(load (string-append (Cyc-installation-dir) "/scheme/cyclone/common.so"))
|
;; (load (string-append (Cyc-installation-dir) "/scheme/cyclone/common.so"))
|
||||||
(load (string-append (Cyc-installation-dir) "/scheme/parser.so"))
|
;; (load (string-append (Cyc-installation-dir) "/scheme/parser.so"))
|
||||||
(load (string-append (Cyc-installation-dir) "/scheme/cyclone/util.so"))
|
;; (load (string-append (Cyc-installation-dir) "/scheme/cyclone/util.so"))
|
||||||
(load (string-append (Cyc-installation-dir) "/scheme/cyclone/libraries.so"))
|
;; (load (string-append (Cyc-installation-dir) "/scheme/cyclone/libraries.so"))
|
||||||
(load (string-append (Cyc-installation-dir) "/scheme/cyclone/transforms.so"))
|
;; (load (string-append (Cyc-installation-dir) "/scheme/cyclone/transforms.so"))
|
||||||
(load (string-append (Cyc-installation-dir) "/scheme/cyclone/cgen.so")))
|
;; (load (string-append (Cyc-installation-dir) "/scheme/cyclone/cgen.so")))
|
||||||
(else #f))
|
;; (else #f))
|
||||||
|
|
||||||
;; Code emission.
|
;; Code emission.
|
||||||
|
|
||||||
|
@ -51,6 +51,7 @@
|
||||||
(define imported-vars '())
|
(define imported-vars '())
|
||||||
(define lib-name '())
|
(define lib-name '())
|
||||||
(define lib-exports '())
|
(define lib-exports '())
|
||||||
|
(define lib-renamed-exports '())
|
||||||
|
|
||||||
(emit *c-file-header-comment*) ; Guarantee placement at top of C file
|
(emit *c-file-header-comment*) ; Guarantee placement at top of C file
|
||||||
|
|
||||||
|
@ -66,17 +67,18 @@
|
||||||
(cons
|
(cons
|
||||||
(lib:name->symbol lib-name)
|
(lib:name->symbol lib-name)
|
||||||
(lib:exports (car input-program))))
|
(lib:exports (car input-program))))
|
||||||
|
(set! lib-renamed-exports
|
||||||
|
(lib:rename-exports (car input-program)))
|
||||||
(set! imports (lib:imports (car input-program)))
|
(set! imports (lib:imports (car input-program)))
|
||||||
(set! input-program (lib:body (car input-program)))
|
(set! input-program (lib:body (car input-program)))
|
||||||
;; Add any renamed exports to the begin section
|
;; Add any renamed exports to the begin section
|
||||||
(let ((renames (lib:rename-exports (car input-program))))
|
|
||||||
(set! input-program
|
(set! input-program
|
||||||
(append
|
(append
|
||||||
(map
|
(map
|
||||||
(lambda (r)
|
(lambda (r)
|
||||||
`(define ,(caddr r) ,(cadr r)))
|
`(define ,(caddr r) ,(cadr r)))
|
||||||
renames)
|
lib-renamed-exports)
|
||||||
input-program)))
|
input-program))
|
||||||
;; Prepend any included files into the begin section
|
;; Prepend any included files into the begin section
|
||||||
(if (not (null? includes))
|
(if (not (null? includes))
|
||||||
(for-each
|
(for-each
|
||||||
|
|
Loading…
Add table
Reference in a new issue