The idea, which originated with Knuth, is to write a program and its documentation at the same time, interleaved with each other.
…
In literate programming, the code is subservient to the documentation. For example, the various sections of the code are written not in the order the compiler (or interpreter) wants them, but in the order most appropriate for the explanation. Two utility programs transform the combination file: one to typeset the documentation and the code via TeX, and the other to extract and rearrange the source code and send it to the compiler.
— More shell, less egg
— Dr. Drang
2011.12.14 Wednesday ACHK