Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456 Noweb home page
noweb is designed to meet the needs of literate programmers while
remaining as simple as possible. Its primary advantages are
simplicity, extensibility, and language-independence—especially
noticeable when compared with other literate-programming tools. noweb uses 5
control sequences to WEB's 27. The noweb manual is only 4 pages; an
additional page explains how to customize its LaTeX output. noweb
works ``out of the box'' with any programming language, and supports
TeX, latex, HTML, and troff back ends. A back end to support full
hypertext or indexing takes about 250 lines; a simpler one can be
written in 40 lines of awk. The primary sacrifice relative to WEB is
that code is seldom prettyprinted.
Noweb's master distribution is here.
noweb has been used for fifteen years at many universities and
industrial sites.
It has been used for tens of thousands of lines of code in such
languages as awk, C, C++, Haskell, Icon, Modula-3, Objective Caml, PAL, perl, Promela,
R, Turing, and Standard ML.
I maintain a list of people and projects that
use noweb.
introduce literate programming with noweb.
The article from Linux Journal is more elementary;
the article in Software explains what makes
noweb simple and extensible (and why those are important).
The original Linux Journal article is marred by a serious
printing error—the chunk syntax is
<<name>>
and not<<name> as shown in the
article.
This error is corrected in the Web version.
The Software article is riddled with minor errors; send me
a postcard and I'll happily send you a reprint
with errors corrected.
Otherwise,
nothing's new.
I am using
Noweb 3
every day, but I think the rationale for Noweb 3 has come and gone,
and I doubt I will ever take it out of ``alpha'' stage or
port it to
Lua version 5.x, which it
richly deserves.
Newcomers should know that versions numbered 2.x are mature and may
be preferred to version 3.
As of 21 July 2011, the current supported version is version 2.11b.
Example programs rendered in HTML,
including hypertext links created
automatically from the noweb source.
Most have had their documentation chunks automatically converted
from latex.
Many kind people have sent postcards, which
have been viewable online since April, 1998.
One of noweb's greatest strengths is that you can begin by
using a vanilla system, then gradually add extensions and
customizations as needed, all without even recompiling.
The Noweb Hacker's Guide explains how
noweb works in sufficient detail for you to add new
features. (An HTML version of the guide is
available, but because it is converted automatically from latex
source, it is not authoritative.)
The extensibility strategy is sketched
here.
noweb's custom extensions include the ability to parse
and manipulate nuweb files, and the ability to convert LaTeX to
HTML. This nuweb program formatted with
noweb tools shows off both.
A separate page discusses
noweb's indexing capability.
Several idiosyncracies arise because noweb is
language-independent.
The Lyx document processor, which
provides a WYSIWYG interface but is compatible with LaTeX, has
supported Noweb since March, 1999.
Since Version 2.8a, the distribution has included Thorsten Ohl's noweb-mode
for Emacs.
Joe Kelsey has written a promising class for emacs mmm-mode,
but it doesn't quite work out of the box yet.
Felix Gaertner has built Pretzel,
a prettyprinter generator that works with noweb.
Sven Kloppenburg, a student of Felix's, has built
Noerr,
which rewrites error messages so that language implementations without
#line can work nicely with noweb.
As originally conceived by Don Knuth, literate programming involves
prettyprinting code: displaying it using several fonts,
mathematical symbols, and with stylized indentation
and line breaks.
I believe this treatment was inspired by the ``publication syntax'' of
Algol 60.
For three reasons, however, I myself seldom use prettyprinting:
Most of my programs are edited at least as often as they are read,
and it is distracting to have to switch between plain ASCII for
editing and fancy fonts and symbols for reading.
It is much better for the literate-programming tool to display the
code almost exactly as written.
(I do believe in typographical distinction for chunk names.)
Prettyprinting is necessarily a language-dependent function, and I
haven't got time to create pretty printers for each of the many
languages I use.
My experience with prettyprinting is that it tends to distract
people from the real work of programming and writing.
People spend lots of time tinkering with prettyprinters, trying to get
the output just right.
I do see a place for prettyprinting—prettyprinting can be helpful
for archival programs that are read much more often than they are
edited, e.g., if they appear in published books or journals.
noweb supports prettyprinting through the use of
``prettyprinting filters,'' and there are several such filters in
noweb's contrib directory, including one that I
wrote, so this had better quash all rumors that I will never use a
prettyprinter.
I enjoy hearing from noweb users; if you have enjoyed noweb, why not
send me a local postcard for my collection? My address is:
Norman Ramsey
Department of Computer Science, Halligan Hall
161 College Ave
Tufts University
Medford, MA 02155
USA
You can also send electronic mail to
nr@cs.tufts.edu.
For Linux users,
I recommend getting the Debian package.
For others,
a gzipped tar file is available.
I also tried to make a
Red Hat RPM; I'd appreciate
hearing if it works.
(Note to old-timers: noweb is still mirrored on CTAN, but
since I first started distributing noweb in the early 1990s, our ideas
of how to get things have changed—as have our ideas of what's big.
In the bad old days, CTAN built zipped tar files on the fly to save
disk space. Since the collapse of this service circa 2003, I no
longer recommend getting noweb from CTAN.)
Precompiled
binaries for
Debian and
NetBSD 1.3.x (g)
are available.
Noweb is copyright 1989–2011 by
Norman Ramsey. All rights reserved.
You may use and distribute noweb for any purpose, for free. You may
modify noweb and create derived works, provided you retain the
copyright notice, but the result may not be called noweb without my
written consent. You may do
anything you like with programs created with noweb.
You may even sell noweb itself, for example, as part of a
CD-ROM distribution, provided that what you sell is the true,
complete, and unmodified noweb.
Without wanting to be elitist, the thing that will prevent literate
programming from becoming a mainstream method is that it requires
thought and discipline. The mainstream is established by people who
want fast results while using roughly the same methods that everyone
else seems to be using, and literate programming is never going to have that kind of
appeal. This doesn't take away from its usefulness as an approach.
—Patrick TJ McPhee