summaryrefslogtreecommitdiff
path: root/module/ice-9/compile-psyntax.scm
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2009-05-04 11:57:36 +0200
committerAndy Wingo <wingo@pobox.com>2009-05-04 11:57:36 +0200
commit71f46dbd5ecf62809c2aa475b6f5742993ada0b9 (patch)
treef9aa243a579c99525027c929525ec77aa8d00b84 /module/ice-9/compile-psyntax.scm
parent123f8abb2da5ed7b2d8ccd67b3bd3532aa9d257e (diff)
downloadguile-71f46dbd5ecf62809c2aa475b6f5742993ada0b9.tar.gz
sc-expand in compile mode produces (ice-9 expand-support) structures
* module/ice-9/psyntax.scm (*mode*): New moving part, a fluid. (sc-expand): Dynamically bind *mode* to the expansion mode. (build-global-reference): Change to be a procedure instead of local syntax. Import the logic about when to make a @ or @@ form to here, from boot-9.scm. If we are compiling, build output using (ice-9 expand-support)'s make-module-ref, otherwise just making the familiar s-expressions. (This will allow us to correctly expand in modules in which @ or @@ are not bound, at least when we are compiling.) (build-global-assignment): Use the result of build-global-reference. A bit hacky, but hey. (top-level-eval-hook, local-eval-hook): Strip expansion structures before evalling. * module/ice-9/boot-9.scm (make-module-ref): Remove, this logic is now back in psyntax.scm. * module/ice-9/compile-psyntax.scm (source): Since we expand in compile mode, we need to strip expansion structures. * module/ice-9/expand-support.scm (strip-expansion-structures): Remove the logic about whether and how to strip @/@@ from here, as it's part of psyntax now. * module/ice-9/psyntax-pp.scm: Regenerated. * module/language/scheme/compile-ghil.scm (compile-ghil): Strip expansion structures -- for now. In the future, we might translate directly from these structures into GHIL.
Diffstat (limited to 'module/ice-9/compile-psyntax.scm')
-rw-r--r--module/ice-9/compile-psyntax.scm4
1 files changed, 3 insertions, 1 deletions
diff --git a/module/ice-9/compile-psyntax.scm b/module/ice-9/compile-psyntax.scm
index 3a8a4fad9..853586e12 100644
--- a/module/ice-9/compile-psyntax.scm
+++ b/module/ice-9/compile-psyntax.scm
@@ -1,3 +1,4 @@
+(use-modules (ice-9 expand-support))
(let ((source (list-ref (command-line) 1))
(target (list-ref (command-line) 2)))
(let ((in (open-input-file source))
@@ -11,7 +12,8 @@
(close-port out)
(close-port in))
(begin
- (write (sc-expand x 'c '(compile load eval))
+ (write (strip-expansion-structures
+ (sc-expand x 'c '(compile load eval)))
out)
(newline out)
(loop (read in))))))