[plt-scheme] reader macros / literate programming

From: Jose A. Ortega Ruiz (baggins at telefonica.net)
Date: Thu Feb 13 17:02:13 EST 2003

MJ Ray <markj at cloaked.freeserve.co.uk> writes:

> Jose A. Ortega Ruiz <baggins at telefonica.net> wrote:
> > on a totally unrelated note, i've been using in the past noweb for
> > literate programming (mostly in OCaml), and was thinking of using it
> > with my MzScheme hacks. as you problably know, in LP, source code
> > files are produced from a document that contains both the source code
> > and its documentation intermingled.
> Interesting.  What system are you using?  I know that Kirill Lisovsky's Mole
> system can produce documentation from comments in source code (sort of like
> perldoc), but I've not found a very practical system for the other way
> round.

i'm using 'noweb' (http://www.eecs.harvard.edu/~nr/noweb/); it's a
simplified, language-agnostic version of Knuth's CWEB. imho, it is
extremly practical and simple to use...

> > the actual source code is automatically generated from such a document.
> > when you compile/interpret such generated files, it is very useful to have
> > some sort of #LINE directive (=E0 la C) in the generated code [...]
> You could probably make the generator intersperse your code with display
> calls when debugging, but then, would that work during module loading? 
> Probably, but I've not tried.  The other thing which will bite you is that a
> lot of the errors in scheme code (well, mine, anyway) are run-time and have
> to be picked up by a testing framework.

hm, yes, although this would amount to implementing the functionality
i'm looking for myself... as another poster suggested, i'll take a
look at read-syntax's docs and maybe give it a try.


A designer knows he has achieved perfection not when there is
nothing left to add, but when there is nothing left to take away.
- Antoine de Saint-Exupery

Posted on the users mailing list.