[plt-scheme] s-exp and custom reader

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Tue Jul 15 09:29:07 EDT 2008

At Mon, 14 Jul 2008 14:27:18 -0700, YC wrote:
> On Mon, Jul 14, 2008 at 1:50 PM, Sam TH <samth at ccs.neu.edu> wrote:
> 
> > It should be fairly easy to write a language like `s-exp' but where
> > the reader and the language are both specified.  Invocations would
> > look something like this:
> >
> > #lang custom (lib "my-reader.ss") (lib "my-lang.ss")
> > ..code goes here..
> >
> 
> Agreed - it should be fairly straight forward. But as `#lang` cannot
> take a `(planet
> ...)` module spec - the language custom will have to be built-in instead of
> user supplied, otherwise anyone doing this will have to manually copy the
> custom lib to collects-dir with each upgrade.

You can also use

 #lang planet <planet path>

where <planet path> is the "symbol" form of a planet path.

This doesn't seem to be documented anywhere. Also, `#lang planet'
handles syntactic mistakes in <planet path> badly. We'll work on those
problems.

> These solutions came about because of the restrictions placed on `#lang`.
> Are there technical difficulties for `#lang` to handle `(planet ...)`?

We're trying to not bias the syntax of a language specification after
`#lang' to Scheme --- or even to S-expression syntax. So that's why
`(planet ...)' and other S-expression variations are not supported in
that position.


Matthew



Posted on the users mailing list.