[Purdue-pm] Extensible Literate Programming in Perl

Mark Senn mark at purdue.edu
Sun Mar 21 18:45:52 PDT 2010


The FunnelWeb Tutorial Manual [1] has a good description of literate
programming:

    A traditional computer program consists of a text file containing
    program code. Scattered in amongst the program code are comments
    which describe the various parts of the code.

    In literate programming the emphasis is reversed. Instead of writing
    code containing documentation, the literate programmer writes
    documentation containing code. No longer does the English commentary
    injected into a program have to be hidden in comment delimiters at
    the top of the file, or under procedure headings, or at the end of
    lines. Instead, it is wrenched into the daylight and made the main
    focus. The "program" then becomes primarily a document directed at
    humans, with the code being herded between "code delimiters" from
    where it can be extracted and shuffled out sideways to the language
    system by literate programming tools.

    The effect of this simple shift of emphasis can be so profound as to
    change one's whole approach to programming. Under the literate
    programming paradigm, the central activity of programming becomes
    that of conveying meaning to other intelligent beings rather than
    merely convincing the computer to behave in a particular way. It is
    the difference between performing and exposing a magic trick.

I'm writing TELPS, The Extensible Literate Programming System.  I
mainly started working on it to better explain my solution to the
"PRE-CHRISTMAS SALE" Purdue Perl Mongers challenge problem.  The
commentary section can contain text and math notation using LaTeX and
graphics using MetaPost.  Other processors can be added easily (for
example, to call Mathematica to do some computations or graphics to
instert in the commentary).  See [2] for more information about TELPS
and an example.  I'll be improving it.

[1]  http://www.ross.net/funnelweb/tutorial/intro_what.html
[2]  http://www.sharpresearch.com/telps/

Mark Senn


More information about the Purdue-pm mailing list