Thu Apr 30 11:10:51 CEST 2009

postprocessing macro using expand-to-top-form

Maybe I should give it a try again, to make ns-tx a postprocessing


The problem is: expansion needs to stop before any bindings are
introduced in body code.

It looks like expand-syntax-to-top-form is necessary since the lexical
environment needs to be left intact.

Maybe do it in this way: use expand-syntax to figure out which
identifiers are in binding position so they can be mapped.


I find it strange why I can't get this to work (wont match):

          (syntax-case top-form (define-values)
                 ((define-values (name ...) expr)
                  #`(#,(datum->syntax stx 'define-values)
                     #,(prefixed-list #'(name ...)) expr))

And have to resort to something like this:

          (syntax-case top-form ()
                 ((form (name ...) expr)
                  (form? 'define-values)
                  #`(#,(datum->syntax stx 'define-values)
                     #,(prefixed-list #'(name ...)) expr))

The datum->syntax take 'define-values from the caller's
context.. Maybe that's not a good idea, and it should be our context.

The expanded form's tag itself is not visible in the caller's context,
so we cant just re-insert it.

I got it to work, but I don't understand why 'define still shows
up.. Thought that was not a primitive form? (-> define-values)

Anyways, where was I.

define-signature for forth parsers...  this won't work with
expand-to-top-form in ns-tx.. probably best to do it in a separate