[<-] [ ^ ] [->] Previous: Organisation Up: Literate Programming and WEB Next: Difficulties with WEB
Overview of WEB
A WEB source file contains all the code and associated documentation in a
form which can be read by one of two programs:
-
- reads WEB and outputs source code for the compiler. This
code is stripped of all pretty formatting and, optionally, comments and is not
intended for human eyes.
-
- reads WEB and produces [TeX] or [LaTeX] output for
processing by either of these typesetting sytems. It is the woven output
which is the readable document. We shall assume the use of [LaTeX] for the remainder of the report.
The WEB file is divided into sections (formally called modules) each of
which contains a description section in [LaTeX] and (optionally) a code
section.
These pieces of code may be full procedures but may often just be code
fragments, such as the declaration of a class in C++. Any such section may
be given a name and inserted by name any number of times in any number of
places in the source code (tangled) output - hence the name! It appears
only once in the woven output, the equivalent of the programming listing.
Hence we get the opportunity to order things in the WEB document in a way
quite different to the source code which the compiler will see.
WEB has a host of features for cross-referencing and indexing which do
not really concern us here.
From a teaching perspective a positive feature is that it is public domain
and available on a variety of UNIX and other platforms.
WEB comes in a variety of implementations and meta-webs (spiders) also
exist for creating webs for any given language. The version with which we
have experimented is FWEB from John Krommes at Princeton.