Next / Previous / Contents / TCC Help System / NM Tech homepage

4.  Literate exposition of the litsource program itself

The litsource program is worth study as an example not only of literate programming but also of how easy it is to process XML files in Python.

Here are some good resources for learning about Python's XML libraries:

4.1. The prologue

The script starts with the usual Python prologue. The first line makes the script self-executing. This is followed by minimal comments pointing to the online form of the literate programming document, and the Cleanroom intended function for the program as a whole.

#!/usr/bin/env python
#================================================================
# litsource:  Extract code from literate-programming source files.
#   For documentation, see:
#       http://www.nmt.edu/tcc/help/lang/python/examples/litsource/
#----------------------------------------------------------------
# Overall intended function:
#   [ output files named in input files given on the command line
#         :=  code fragments designated for those files
#     sys.stderr  +:=  error messages if any ]
#----------------------------------------------------------------