[gambit-list] Meroon and syntax-case?

Marc Feeley feeley at iro.umontreal.ca
Thu Mar 22 07:36:12 EDT 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


On 22-Mar-07, at 4:11 AM, Phil Dawes wrote:

> Hi Gambit List,
>
> I really like the meroonet object system, however my program contains
> quite a few syntax-case macros and the meroonet common-lisp style  
> macros
> don't work once syntax-case is loaded.
>
> I've found that I can switch between the two macro systems using:
>
> (define (switch-to-lisp-macros)
>    (set! ##expand-source
>          (lambda (src)
>            src)))
>
> (define (switch-to-syntax-rules-macros)
>    (set! ##expand-source
>          (lambda (src)
>            (sc-expand src))))
>
> ... however this is both a hassle and a global change which I'm  
> guessing
> prob won't work with threading etc..
>
> Has anybody attempted to build a meroon style system using syntax-case
> macros? Any pointers would be much appreciated.

Have you considered implementing define-macro on top of syntax-case?   
I'm not sure how much mileage you can get out of it, but here's one  
way of defining define-macro:

(define-syntax define-macro
   (lambda (x)
     (syntax-case x ()
       ((_ (name . params) body1 body2 ...)
        (syntax (define-macro name (lambda params body1 body2 ...))))
       ((_ name expander)
        (syntax (define-syntax name
                  (lambda (y)
                    (syntax-case y ()
                      ((k . args)
                       (let ((lst (syntax-object->datum (syntax args))))
                         (datum->syntax-object
                          (syntax k)
                          (apply expander lst))))))))))))

Marc

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (Darwin)

iD8DBQFGAmos//V9Zc2T/v4RAp+kAKCZ8B9dnxNZ2Gfwx2surh9HiUZqCACgnmBa
lE9Vq1J+pm6KMck11HDrtfY=
=0zfS
-----END PGP SIGNATURE-----



More information about the Gambit-list mailing list