% $Id: faq-litprog.tex,v 1.3 2012/11/24 10:56:03 rf10 Exp $

\section{Literate programming}

\Question[Q-lit]{What is Literate Programming?}

Literate programming is the combination of documentation and source
together in a fashion suited for reading by human beings. 
In general, literate programs combine source
and documentation in a single file.  Literate programming tools then
parse the file to produce either readable documentation or compilable
source.  The \acro{WEB} style of literate programming was created by
D.~E.~Knuth during the development of \TeX{}.

\htmlignore
The ``\Qref*{documented \LaTeX{}}{Q-dtx}'' style of programming
\endhtmlignore
\begin{htmlversion}
  The ``\Qref{documented \LaTeX{}}{Q-dtx}'' style of programming
\end{htmlversion}
is regarded by some as a form of literate programming, though it only
contains a subset of the constructs Knuth used.

Discussion of literate programming is conducted in the newsgroup
\Newsgroup{comp.programming.literate}, whose \acro{FAQ} is stored on
\acro{CTAN}.  Another good source of information is
\URL{http://www.literateprogramming.com/}
\begin{ctanrefs}
\item[\nothtml{\rmfamily}Literate Programming \acro{FAQ}]%
  \CTANref{LitProg-FAQ}
\end{ctanrefs}
\LastEdit{2012-11-16}

\Question[Q-webpkgs]{\acro{WEB} systems for various languages}

\TeX{} is written in the programming language \acro{WEB}; \acro{WEB}
is a tool to implement the concept of ``literate programming''.
Knuth's original implementation will be in any respectable
distribution of \TeX{}, but the sources of the two tools
(\ProgName{tangle} and \ProgName{weave}), together with a manual
outlining the programming techniques, may be had from \acro{CTAN}.

\acro{\ProgName{CWEB}}, by Silvio Levy, is a \acro{WEB} for \acro{C} programs.

\acro{\ProgName{FWEB}}, by John Krommes, is a version for Fortran,
Ratfor,\acro{C}, \acro{C}++, working with \latex{}; it was derived
from \ProgName{CWEB}.

Spidery \acro{WEB}, by Norman Ramsey, supports many 
languages including Ada, \texttt{awk}, and \acro{C}
and, while not in the public domain, is usable without charge.  It is
now superseded by \ProgName{noweb} (also by Norman Ramsay) which
incorporates the lessons learned in implementing spidery \acro{WEB},
and which is a simpler, equally powerful, tool.

\ProgName{Scheme}\acro{\ProgName{WEB}}, by John Ramsdell, is a Unix filter that
translates Scheme\acro{WEB} into \LaTeX{} source or Scheme source.

\acro{\ProgName{APLWEB}} is a version of \acro{WEB} for \acro{APL}.

\ProgName{FunnelWeb} is a version of \acro{WEB} that is language independent.

Other language independent versions of \acro{WEB} are \ProgName{nuweb} (which
is written in \acro{ANSI} \acro{C}).

\ProgName{Tweb} is a \acro{WEB} for \plaintex{} macro files, using
\ProgName{noweb}.
\begin{ctanrefs}
\item[aplweb]\CTANref{aplweb}
\item[cweb]\CTANref{cweb}
\item[funnelweb]\CTANref{funnelweb}
\item[fweb]\CTANref{fweb}
\item[noweb]\CTANref{noweb}
\item[nuweb]\CTANref{nuweb}
\item[schemeweb]\CTANref{schemeweb}
\item[spiderweb]\CTANref{spiderweb}
\item[tangle]\CTANref{web}
\item[tweb]\CTANref{tweb}
\item[weave]\CTANref{web}
\end{ctanrefs}

