Discussion:
Common Lisp replacement for noweb
William Halliburton
2011-03-28 17:47:21 UTC
Permalink
---------- Forwarded message ----------
From: daly <daly-fkGhOwzH+GMtmNyP1c9330B+***@public.gmane.org>
Date: Mon, Mar 28, 2011 at 12:18 PM
Subject: Common Lisp replacement for noweb
To: thomas.m.hermann-vwvrpGovRlrta4EC/59zMFaTQe2KTcn/@public.gmane.org, pro-***@public.gmane.org


I have moved from using noweb to a pure Common Lisp version
of literate programming. (The source is also at:
http://literatesoftware.com/tangle.lisp )

The noweb program uses two functions,
weave -- takes a file and extracts latex
tangle - takes a file and extracts running code

The noweb syntax is:
<<thechunk>>=
your source code
@

where your code is defined in the block delimited by the
<<...>>= and the @ symbol. To use the delimited chunk
somewhere you write the name of the chunk as:
<<thechunk>>


It would be better to use a valid latex environment.
That would mean that there is no need for a "weave" function
since the original file is valid latex.

\begin{chunk}{thechunk}
your code here
\end{chunk}

\getchunk{thechunk}

All that would be left is to make Common Lisp understand
the latex environment syntax which is trivial to do. So I
wrote a tangle.lisp program. It accepts and processes both
the old noweb syntax and the new latex syntax.

The idea is simple. Read the file, hash the chunks, and
expand them when a getchunk is found.

The code is attached.

Send questions to daly-zlKVZYmZP8yttCpgsWEBFlaTQe2KTcn/@public.gmane.org

Tim Daly
daly-fkGhOwzH+GMtmNyP1c9330B+***@public.gmane.org
daly-zlKVZYmZP8yttCpgsWEBFlaTQe2KTcn/@public.gmane.org

Loading...