[plt-scheme] Re: creating new readers
On Oct 26, Hendrik Boom wrote:
> On Sat, 25 Oct 2008 23:09:40 -0600, Jon Rafkind wrote:
>
> > Jon Rafkind wrote:
> >> I am trying to understand how to write a new reader that can be used
> >> with #lang.
> > Eli showed me how to do this, so no worries.
>
> Any chance you could enlighten the rest of us?
The main problem that Jon had was returning a syntax value like
#'(begin ...)
which is a problem, since that syntax already has the lexical context
of the reader module. Instead, it should return a context-less syntax
like
(datum->syntax #f '(begin ...) ...)
(There was another minor issue: it is really better to use
`syntax/module-reader' to create a reader rather than doing so
directly.)
--
((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay:
http://www.barzilay.org/ Maze is Life!