Scheme Macros as Data (Not Program) Transformers

Randall R Schulz <[email protected]> Fri, 28 Mar 2008 11:35:55 -0700
Newsgroups gmane.comp.java.sisc.user
Message-ID <[email protected]>
Hi,

This question is not specific to SISC, but I haven't been able to find 
any treatments in the on-line literature and my request on 
comp.lang.scheme hasn't elicited any responses, so because I'm using 
SISC, I'll ask here.

If this is off-topic, please forgive the intrusion.


I have a variety of needs within a large Java application that are well 
characterized as template-driven rewriting tasks. When I discovered 
Schemes macro capability, I realized it was ideally suited to creating 
the kind of transformers I need.

However, what I have not been able to figure out how to do is to use 
Scheme macros to transform data rather than to create executable code.

The closest I've come so far is to define (using define-syntax, of 
course) a macro that encodes (one of) the transforms I need to create. 
By using a quasiquote as the replacement template, I get the 
s-expression I want as the macro expansion.

The problem, at the moment, is that the only way I can apply this to 
arbitrary input s-expressions (that I read from a file) is by using the 
(eval ...) procedure. Naturally, this does not permit me to limit the 
acceptable inputs to uses of my macros—any arbitrary Scheme could be 
passed and executed, and I don't really want to do that.


Anyway, this is the gist of it. How do you exploit Scheme macros for 
data -> data transformations rather than for program -> program 
transformations?


Thanks.


Randall Schulz

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Sisc-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sisc-users