[<<][staapl][>>][..]
Sat Nov 12 13:17:54 EST 2011

Macros don't support quote

This doesn't work:

(let ((p ....))
  (forth-begin path ,p))

The problem is in macro-forth-sig.ss

I have a phase problem.  How to get the string "pic18", represented by
a value, injected into the body of the macro?

   (define-syntax forth-begin
     (lambda (stx)
       (syntax-case stx ()
         ((_ . code)
          #`(begin
              (mf:forth-begin
               path #,(build-path (home) "pic18")  ;; library path
               . code)
              (mf:compile!))))))


The word after 'path' is always parsed as a literal.  What I need is a
form like

   "asdfasdf" path!


Hmm.. then even still..  It's a weird kind of phase mixing!  Find out
what is the real problem here.

It looks like this really needs to be inserted as a compile-time
entity, not a run-time entity.  That's why it can't be done in the
signature definition, because macros in a sig def can only depend on
identifiers in the signtature.

The underlying reason of this needing to be a compile-time entity is
because the file search path representation is also a compile-time
entity, so the let form at the top of this post is meaningless: the
binding doesn't exist at expansion time.


I fixed the issue by moving the '(library "pic18") form to
pic18/lang.ss and added a stub to insert that term in the
live/command.ss interpreter by means of `forth-begin-prefix' which can
insert the same.  Now forth-begin is generic.



[Reply][About]
[<<][staapl][>>][..]