So, I am writing a Scheme to JavaScript compiler. Because I want to<br>write the macro and module system later, my idea was to use<br>PLT Scheme&#39;s macro and module system, for now. Of course, this<br>probably must be done with some kind of hack. I&#39;m just trying to find<br>
one that is reliable.<br><br>My first approach was to expand the module in the reader,  store this <br>expanded code (later will be translated to JavaScript), and replace<br>the expressions in the expanded code by (void), so that the module<br>
just read, and to be returned by the reader, has no expressions. This<br>is necessary because this code is to be evaluated later in the web<br>browser. I&#39;m using PLT to read, macro-expand but not evaluate the<br>module.<br>
<br>After reading what you wrote, I changed the process a bit. I still expand<br>the code in the reader but then I return the read module, without <br>replacing the expressions, but in a different language. In that new language,<br>
I have #%app to expand to #&#39;(void). It works, but I have two languages<br>that are different only in the provided #%app.<br><br>Now I&#39;m trying a new approach. Instead of expanding the module in the<br>reader, I export a #%module-begin that replaces its subforms by a <br>
new macro that code-walks by using local-expand and some other <br>hacks. This does not mix read and macro expansion levels, but I have to<br>10 times more code.<br><br>Anyway, I know that all this is an hack, but... what is the best way to<br>
do what I want? Is there a less hacky way to proceed? <br><br>
On Fri, Nov 20, 2009 at 5:15 AM, Eli Barzilay <span dir="ltr">&lt;<a href="mailto:eli@barzilay.org">eli@barzilay.org</a>&gt;</span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

But my first thought when I saw that (or rather when someone pointed<br>
at your question when you raised it on #scheme) is that you&#39;re trying<br>
to do some CL-ish kind of a code walker.  (And I did see that you<br>
mentioned that this is a translation of CL code, so it seems<br>
relevant.)  In this case, I think that trying to *match* on `#%app&#39;s<br>
is missing its point.  The role of `#%app&#39; is as a kind of a hook that<br>
you can use to redefine what happens on every point where a function<br>
is being applied *instead* of using a code walker.<br></blockquote></div><br>This code is not ported from CL. Although I do have some work in CL that<br>I want to port to Scheme, this is just my experiments in a new system.<br>
I still don&#39;t known PLT (and Scheme) well enough to not make some newbie<br>mistakes. That said, I&#39;ve been writing CL for the last 3 years; probably I&#39;m<br>still thinking in CL.<br><br>Thanks.<br><br>Marco<br>

<br>
P.S. Yes, I am aware of Moby.<br>


<br>