[racket] Read-syntax for an entire .rkt file
Hi,
I am trying to figure out how to use read-syntax on a port for an entire
.rkt file. I want to then call (expand ...) on this and get back a (begin
...) or (module ...) form for the entire file in fully expanded form. Right
now I have three issues:
a) I have to skip over the #lang as this is not recognized by read-syntax
itself
b) I've needed to call read-syntax repeatedly to consume the whole file and
put each expression in a top-level begin (a pretty klugy workaround)
c) even then, calling expand will report an error that "define" is not
itself defined. Maybe there is a version of read-syntax that will use
read-language internally in the right way but I can't find it.
There is probably a way of doing all of this at once, and better, but I
don't know what that would be. I feel read-language is needed, but I don't
see how this would work together with read-syntax.
Any advice or pointers would be greatly appreciated!
--
Tom
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20150218/cdaf1572/attachment.html>