Donald Knuth has a large number of programs to read on his page. But they are mostly in a "strange" CWEB format...
What could be the best way to make them appropriately readable in Windows?
Donald Knuth has a large number of programs to read on his page. But they are mostly in a "strange" CWEB format...
What could be the best way to make them appropriately readable in Windows?
Less than five minutes of Googling brings this up: http://www.literateprogramming.com/cweb_download.html
The way I find most convenient to read a CWEB
program is by running cweave
(manpage) on the .w
source file to generate a .tex
file, and then running pdfetex
to get a nice hyperlinked PDF. Pictorially:
`.W SOURCE ----(cweave)----> .TEX ----(pdfetex)----> PDF`
As you would be aware, the structure of a CWEB
program is itself sort of hyperlinked (with sections referring other sections). Having a nice, linked PDF is a sheer pleasure to read, specially if the programs have been written by Don Knuth himself!
The following setup would involve some effort on your part (and MBs of download), but I hope you'll like the final result:
cweave
and ctangle
with cygwin, download the sources and build/install those.Once cygwin and cweb have been installed, do the following to any .w
program you wish to study (I'm taking an example of bdd12.w
):
cweave
like so: cweave bdd12.w
This should generate a bdd12.tex
file.pdfetex
like so: pdfetex bdd12.tex
This should get you a neat, cross-referenced PDF. The generated PDF also has an index of symbols at the end (and some more crossreferencing data), so you can quickly jump to their definitions.