[gambit-list] Compiling "post-reader" forms?

Nathan Sorenson takeoutweight at hotmail.com
Sun Jun 2 01:54:27 EDT 2013


> (define (f x y)
>   (+ 1
>      (source-at "foo.scm" 10 2 ;; file line column
>                 (/ x y))))

This
 is a clean approach, however one would have to be careful not to wrap macro symbols this way or else one would cause a "can't 
take the value of a macro" error, no?

I considered only applying the macro to lists but unbound variable errors won't report 
correct line info in that case. Another option would be to maintain a 
list of scheme macro symbols and ensure the clojure-scheme compiler 
doesn't attach source info to them. Even though it's now possible to run the compiler on Gambit, I want to maintain the possibility of doing the compilation entirely within the JVM, so I won't have any way to resolve symbols at run-time to see if they are macros.

Perhaps an easier approach 
would be to use a reader-macro, so that source info can be applied 
before regular macro expansion. Is it possible to tell gsc to use a 
custom read table? Or perhaps the ast parser would clobber the line info produced by any reader macros?
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.iro.umontreal.ca/pipermail/gambit-list/attachments/20130602/253cdd4b/attachment.htm>


More information about the Gambit-list mailing list