diff options
Diffstat (limited to 'module/ice-9/compile-psyntax.scm')
-rw-r--r-- | module/ice-9/compile-psyntax.scm | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/module/ice-9/compile-psyntax.scm b/module/ice-9/compile-psyntax.scm new file mode 100644 index 000000000..8b53267fe --- /dev/null +++ b/module/ice-9/compile-psyntax.scm @@ -0,0 +1,20 @@ +(use-modules (language tree-il) (ice-9 pretty-print)) +(let ((source (list-ref (command-line) 1)) + (target (list-ref (command-line) 2))) + (let ((in (open-input-file source)) + (out (open-output-file (string-append target ".tmp")))) + (write '(eval-when (compile) (set-current-module (resolve-module '(guile)))) + out) + (newline out) + (let loop ((x (read in))) + (if (eof-object? x) + (begin + (close-port out) + (close-port in)) + (begin + (pretty-print (tree-il->scheme + (sc-expand x 'c '(compile load eval))) + out) + (newline out) + (loop (read in)))))) + (system (format #f "mv -f ~s.tmp ~s" target target))) |