From a82a34f9648f351c3fb732731178e12a31f2fead Mon Sep 17 00:00:00 2001 From: Justin Ethier Date: Thu, 13 Aug 2015 21:25:58 -0400 Subject: [PATCH] Experimenting with adding .meta files --- TODO | 5 +++++ cyclone.scm | 9 +++++++++ 2 files changed, 14 insertions(+) diff --git a/TODO b/TODO index be555612..10db4b56 100644 --- a/TODO +++ b/TODO @@ -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 - 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? 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 diff --git a/cyclone.scm b/cyclone.scm index a049438c..252b4d17 100644 --- a/cyclone.scm +++ b/cyclone.scm @@ -246,6 +246,7 @@ '())) (exec-file (basename in-file)) (src-file (string-append exec-file ".c")) + (meta-file (string-append exec-file ".meta")) (create-c-file (lambda (program) (with-output-to-file @@ -278,6 +279,14 @@ (write comp-prog-cmd) (write comp-objs-cmd))))) (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 (string-append "gcc " src-file " -g -c -o " exec-file ".o"))) (cond