I'm trying to store a representation of the expanded code in some module.<br>I'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> 'module-begin '())])<br>
(with-syntax ([code a]<br> [(_ body ...) a])<br> (syntax/loc stx (#%module-begin<br> (mute body) ...<br> (add-code #'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>
"compile: access from an uncertified context to unexported variable<br>from module".<br><br>In some cases, I don't have access to the macros. For example, I'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