I&#39;m trying to store a representation of the expanded code in some module.<br>I&#39;m currently using one method that translates the syntax to an AST when<br>expanding the #%module-begin in my language. I am experimenting with<br>
storing the syntax instead, like so:<br><br>(define-syntax (_#%module-begin stx)<br>  (syntax-case stx ()<br>    [(_ . forms)<br>     (let ([a (local-expand (syntax/loc stx (#%plain-module-begin . forms))<br>                            &#39;module-begin &#39;())])<br>
       (with-syntax ([code a]<br>                     [(_ body ...) a])<br>         (syntax/loc stx (#%module-begin<br>                          (mute body) ...<br>                          (add-code #&#39;code)))))]))<br>
<br>. In this code, the add-code procedure stores the syntax object.<br><br>This almost works. The problem is that the expanded code can contain<br>identifiers from other modules that are not exported, so I get errors like<br>
&quot;compile: access from an uncertified context to unexported variable<br>from module&quot;.<br><br>In some cases, I don&#39;t have access to the macros. For example, I&#39;m using<br>quasiquote from scheme that expands to use qq-expand that is not exported.<br>
<br>Is it possible to make this, or something similar, work?<br><br>Marco