The system that Knuth produced to support literate programming is called WEB. Its software processes a source file to produce two outputs: a document in the TeX notation, with the program fragments rather elaborately formatted, and the executable program code. WEB is a moderately complex system, with a 22-page user's manual [Knuth 1983]. It uses some 27 special sequences of characters, along with other notation conventions, to control the processing and formatting of the literate program.
In the document output, WEB renders the program fragments using different fonts and placement for different kinds of words and symbols, and so it was designed to be used with one particular programming language, which happens to be Pascal. Other versions of WEB have been created for other programming languages, including C. There are also language-independent versions such as Noweb [Ramsey] that are considerably simpler than WEB but don't render the program fragments as elaborately. Some recent literate-programming systems use XML, rather than a markup language like TeX, for the underlying document; see [Walsh N] for an example.
In all of these systems, the program fragments form a hierarchical structure, with some fragments logically included in others. The fragments have names, and fragments refer to each other by name. It is the programmer's responsibility to create this hierarchical structure, using the system's input syntax to give the fragments names and create the cross-references.
When WEB extracts the code, it inserts fragments in place of their names in the texts of other fragments. On the other hand, when producing the document output WEB does no combining or reordering of the program fragments, leaving them in the same positions as in the source file. Thus, the author can present the fragments in the document in an order that is optimal for understanding, independent of the order in which they must appear in the code output. Advocates of literate programing claim this as a great advantage over traditional ways of writing programs.
Please see Knuth's original journal paper on literate programming [Knuth 1984] for an extended example. That paper shows a literate program, as rendered in readable form, and some of the WEB markup that was used to produce it. Notice that the example uses some notation conventions that the reader must learn in order to understand the program, especially its hierarchical structure; this is an essential characteristic of Knuth's style of literate programming.