This is the mail archive of the
kawa@sourceware.org
mailing list for the Kawa project.
Re: Macro expansion
- From: Per Bothner <per at bothner dot com>
- To: Dan Stanger <DStanger at EatonVance dot Com>
- Cc: kawa at sources dot redhat dot com
- Date: Tue, 21 Apr 2009 12:46:37 -0700
- Subject: Re: Macro expansion
- References: <4995B1AFF8CBC64B8FD474D4A718D5BF1A2E3B3B@BOS-300-00.eatonvance.com> <DE68D979461DD145AF50732B9C185AEF027B350A@BOS-300-00.eatonvance.com>
On 04/21/2009 11:37 AM, Dan Stanger wrote:
Is it possible to view macro expanded source, that is to take a source
file, have the macros expanded, and output the processed source?
If you want to just see that the "processed output" looks like,
try --debug-print-expr. That shows you the Expression tree in
pretty-printed form.
However, this format is not S-expressions, and it's designed
for me to figure out what the compiler is doing, rather than
to look like "core Scheme".
Unfortunately, there is no way to output the processed source
because there is no such thing. Macro expansion is combined
with and interleaved with converting to Expression format.
In fact, you can write a macro that returns an Expression
- that is how the (if ...) form is implemented - see the
definition in kawa/lib/prim_syntax.scm. Likewise
try-finally and synchronized in syntax.scm.
--
--Per Bothner
per@bothner.com http://per.bothner.com/