[gambit-list] syntax-case and DSSSL

Marc Feeley feeley at iro.umontreal.ca
Tue May 22 22:54:45 EDT 2007


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


On 21-May-07, at 8:24 PM, James Cash wrote:

> So, once I've loaded syntax-rules, I can only use the DSSSL  
> extensions in ##define forms, but I can only use syntax macros in  
> define forms.  Is there any way around this?  Do I have to prefix  
> the syntax macros with a specific namespace? I'm assuming that's  
> what the problem is, the macros being in a different  
> namespace...but which one?

No that's not the problem.  The syntax-case system has its own macro  
expander that operates before the Gambit built-in expander.  The  
syntax-case system is the portable syntax-case implementation  
(version 7.3) extended to treat the forms "##define", "##define- 
macro", etc like "core" forms (for which the arguments are not macro- 
expanded).  So if you type the expression E it is macro-expanded to  
E' by the syntax-case macro expander, and then the Gambit parser  
expands the macros built-in to Gambit to get E'' which is then  
assigned a meaning according to the forms known to Gambit, including  
things like "##define" and the DSSSL parameter notation.

So, if E is

(##define (bar x)
   (twice x))

the syntax-case expander classifies this as a core form with *no*  
macro-expansion of the arguments.  So the macro-expansion produces E'  
which is identical to E.  Then the Gambit interpreter (or compiler)  
will classify this as a definition of function bar with a body that  
is a *function* call to twice (instead of the intended syntax-case  
*macro* call to twice).

There is no easy general fix.  But you can play around with the file  
misc/psyntax73.ss to modify the handling of ##define so that the  
syntax-case expander expands the body before handing it to Gambit.   
Sorry I can't suggest the correct code (I have a limited  
understanding of how that code works).  After modifying psyntax73.ss  
you can build a new syntax-case.scm by running the shell script  
syntax-case-build .

Marc

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

iD8DBQFGU6z1//V9Zc2T/v4RAhMrAKCGxJNZ0TxDK1cIHXUaLKW0Mye+5ACePCxs
7uOHbB7btOtndcT0OSkfkSo=
=cYvG
-----END PGP SIGNATURE-----



More information about the Gambit-list mailing list