[racket] How to communicate from macro to DrRacket tool ?

From: Nick Main (david.nick.main at gmail.com)
Date: Thu Apr 4 21:15:19 EDT 2013

Many thanks for the advice !

I've start forging ahead with the syntax-property approach since that seems
the most robust and provides the least coupling between the stages.




On Thu, Apr 4, 2013 at 2:39 AM, Sam Tobin-Hochstadt <samth at ccs.neu.edu>wrote:

> On Wed, Apr 3, 2013 at 10:31 PM, Robby Findler
> <robby at eecs.northwestern.edu> wrote:
> >
> > You can put syntax properties on the result of your expander for the
> > state-machine macro and then search for those properties in the expanded
> > text. Maybe that will help?
>
> There's information about how Typed Racket does this (using roughly
> the technique Robby outlined, plus others) in our papers about the
> implementation, from PLDI 2011 and the Scheme Workshop 2007 [1,2].
>
> The other significant technique is basically the following:
>
> Expand a form like:
>
>    (my-special-dsl some arguments here)
>
> to
>
>    (begin (define-values () (begin (quote-syntax (my-special-dsl some
> arguments here)) (values)) ;; just the original input syntax
>                the-actual-expansion)
>
> Then your tool can look at the results of expansion (via the hook
> Robby describes) and find occurrences of this pattern, and discover
> your DSL. Note that this only really works if either (a) your DSL
> doesn't have any general expansion positions as subforms or (b) you
> don't need to analyze those subforms.  Otherwise syntax properties are
> the best route.
>
> Sam
>
> [1] http://www.ccs.neu.edu/racket/pubs/scheme2007-ctf.pdf
> [2] http://www.ccs.neu.edu/racket/pubs/pldi11-thacff.pdf
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20130404/c0cfad89/attachment-0001.html>

Posted on the users mailing list.