Background

The original literate programming idea was invented by Donald Knuth as part of his TeX development. It was based on the idea that software should be developed with the documentation as literature. He named this approach WEB and he intended that it would allow the programmer to produce programs that are self documenting and thus remain exceptionally easy to change. The price to be paid for this advantage is the learning time for the WEB system and the TeX text processing language. The knowledge required of the latter can remain relatively primitive except when specialised text setting is required for tables etc.

This original WEB system was tied to the Pascal language and provided a "pretty-printing" approach which formatted the actual code in a pleasing manner. This, however, placed an enormous restriction on WEB as it tied it to a specific language. Various other approaches to overcome this were presented, such as CWEB and FWEB, including a version where the pretty-printing process was defined in a system called SpideryWeb. I even used SpideryWeb to produce a suitable system for the HDL language ELLA. It soon became apparent that having a separate WEB system for each language was unsustainable, and also precluded the option of having a single WEB file that contained mixed languages.

The most successful of the attempts to make a universal system is NoWeb which had the power of the original WEB system but removed the pretty-printing allowing the programmer to format (indentation etc) the code. It also enables mixed languages to share the same source file.

One huge advantage of NoWeb is the ability to add user defined filters for specific requirements — for example having an HTML output instead of TeX. On the other hand a major disadvantage of NoWeb (and any other literate programming approach) is its relationship with modern IDEs, such as Apple's Xcode. IDEs rely on working with the code file directly and having an earlier source file to be processed to get that code file does not work. While Xcode will allow an Ant build approach, single stepping and general debugging of the source code is not a happy process since it is impossible to debug (single-step) in the IDE from the original NoWeb code.

A Different Approach

Having spent several hours installing NoWeb onto my OS X system I wondered whether there might be a better way to make the system more universal. One common factor of modern operating systems is the Java language, and by implication the Jakarta Ant™ build system. I use this build system extensively for Unix based programs (such as Paloose, which does not use AntWeave since the latter was developed after Paloose).

The system described here is an implementation of NoWeb using Java and designed to be used as an Ant task available for the build process. The advantage is that only a simple jar needs to be distributed with no source code required for the system to be built on new operating systems: the only requirement is that there should be a Java implementation.

Copyright 2015 Hugh Field-Richards. All Rights Reserved.