[plt-scheme] Storing syntax
On Tue, Dec 15, 2009 at 5:37 PM, Chongkai Zhu <czhu at cs.utah.edu> wrote:
> Use syntax-property and 'certify-mode.
>
I don't know how to do this. Doesn't this require changing the macro that
introduces the identifier? How can I do this in the #%module-begin macro
where I use local-expand?
> Chongkai
>
> Marco Monteiro wrote:
>
>> I'm trying to store a representation of the expanded code in some module.
>> I'm currently using one method that translates the syntax to an AST when
>> expanding the #%module-begin in my language. I am experimenting with
>> storing the syntax instead, like so:
>>
>> (define-syntax (_#%module-begin stx)
>> (syntax-case stx ()
>> [(_ . forms)
>> (let ([a (local-expand (syntax/loc stx (#%plain-module-begin . forms))
>> 'module-begin '())])
>> (with-syntax ([code a]
>> [(_ body ...) a])
>> (syntax/loc stx (#%module-begin
>> (mute body) ...
>> (add-code #'code)))))]))
>>
>> . In this code, the add-code procedure stores the syntax object.
>>
>> This almost works. The problem is that the expanded code can contain
>> identifiers from other modules that are not exported, so I get errors like
>> "compile: access from an uncertified context to unexported variable
>> from module".
>>
>> In some cases, I don't have access to the macros. For example, I'm using
>> quasiquote from scheme that expands to use qq-expand that is not exported.
>>
>> Is it possible to make this, or something similar, work?
>>
>> Marco
>> ------------------------------------------------------------------------
>>
>>
>> _________________________________________________
>> For list-related administrative tasks:
>> http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>>
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20091215/90c1ff24/attachment.html>