|
From: | Casey Rodarmor |
Subject: | Re: [Chicken-users] Print source after macro expansion? |
Date: | Tue, 29 Oct 2013 04:36:30 -0700 |
On Tue, Oct 29, 2013 at 12:39:10AM -0700, Casey Rodarmor wrote:
> Hi chickenemers,
Hello Casey,
> I would like to read a file containing macro definitions and a source file,
> and output the source file after macro expansion, but before evaluation.
>
> Is there an easy way to do this? Like with some mysterious flag to csi orYou can try csc -debug 2, which will show the "canonicalized" output.
> csc that just outputs its macro-expanded input?
It will expand all macros and some surrounding cruft that's added
by the compiler for various reasons, but it should be the easiest
way to show macro expansion.
Of course, another classic trick is to put a quote in front of the
expansion code and print the result. This will work fine from the
interpreter as well:
(print (foo))
(define-syntax foo
(syntax-rules ()
((foo) '(+ 1 1))))
;; Or, to see the _expression_ in context:
(print `(* ,(foo) 10))
Cheers,
Peter
--
http://www.more-magic.net
[Prev in Thread] | Current Thread | [Next in Thread] |