[plt-scheme] Syntax objects and strings (or "stupid infix tricks")

From: Corey Sweeney (corey.sweeney at gmail.com)
Date: Thu Dec 7 15:46:11 EST 2006

That works.   (eval `(infix ,(read-syntax `thingy1 (open-input-string "(2 +
3)")))) does produce 5.


For fun I decided to test it's generality, I tried:

(read-syntax `thingy2 (open-input-string "((("))

Which immedately complained about missmatched parenthisis. I don't really
need to do this, but do you know what one would one do if they needed to
parse a language that didn't use parenthisis charactors in the traditional


On 12/7/06, Danny Yoo <dyoo at hkn.eecs.berkeley.edu> wrote:
> > Is there a way to turn a string into a syntax object without calling
> read?
> > Something feels wrong with what i'm doing.  {I mean someting feels wrong
> > beond the fact that i'm dealing with infix notation ;)}
> Hi Corey,
> The function READ-SYNTAX, coupled with making a string look like a port
> through the OPEN-INPUT-STRING function, should do the trick.  Take a look
> at READ-SYNTAX in the help desk first, because it needs to take an extra
> argument, compared to regular READ.
> > i've written a re-infixer that does the reverse of Dannys "infix"
> > package.
> [some code cut]
> Ack!  I didn't mean for things to get this perverse.

((lambda (y) (y y)) (lambda (y) (y y)))
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20061207/94287ee3/attachment.html>

Posted on the users mailing list.