Experimenting with adding .meta files

This commit is contained in:
Justin Ethier 2015-08-13 21:25:58 -04:00
parent 54c3408c6d
commit a82a34f964
2 changed files with 14 additions and 0 deletions

5
TODO
View file

@ -11,6 +11,11 @@ Working TODO list. should start creating issues for these to get them out of her
if necessary, write makefile directive to automate rebuilding cyclone for macro development if necessary, write makefile directive to automate rebuilding cyclone for macro development
- macros - macros
* thought: if we go with meta files, the compiler can revert back
to using compiled macros if we do not install the meta files.
just an idea, may be a hack or not feasible. not an awful idea to
make them optional though, with some restrictions.
how should eval deal with compiled macros? how should eval deal with compiled macros?
do we need a new tag type, eg: macro closure or such? do we need a new tag type, eg: macro closure or such?
then eval could say, if app macro, expand it and call analyze again then eval could say, if app macro, expand it and call analyze again

View file

@ -246,6 +246,7 @@
'())) '()))
(exec-file (basename in-file)) (exec-file (basename in-file))
(src-file (string-append exec-file ".c")) (src-file (string-append exec-file ".c"))
(meta-file (string-append exec-file ".meta"))
(create-c-file (create-c-file
(lambda (program) (lambda (program)
(with-output-to-file (with-output-to-file
@ -278,6 +279,14 @@
(write comp-prog-cmd) (write comp-prog-cmd)
(write comp-objs-cmd))))) (write comp-objs-cmd)))))
(else (else
;; Emit .meta file
(with-output-to-file
meta-file
(lambda ()
(display ";; This file was automatically generated by the Cyclone Scheme compiler")
(newline)
(write (get-macros))))
;; Compile library
(let ((comp-lib-cmd (let ((comp-lib-cmd
(string-append "gcc " src-file " -g -c -o " exec-file ".o"))) (string-append "gcc " src-file " -g -c -o " exec-file ".o")))
(cond (cond