Literate Programming

Literate programming↗ (LP) is a programming paradigm introduced in 1984 by Donald Knuth. A computer program is given as an explanation of how it works in a natural language, such as English, interspersed (embedded) with snippets of macros and traditional source code, from which compilable source code can be generated.

Terminologies

Tangling (org-babel-tangle): This extracts the code blocks from Org mode file and writes them into pure source code files (like .el, .py, or .sh) that the computer can execute.

Weaving: This exports the file into a format suitable for reading (like HTML, PDF, or LaTeX) where the prose and code are cleanly presented for humans.

Examples

I use Org mode to create and maintain the following literate programs and Org Babel↗ tangles them.

dotfiles

myzettel


© Prabu Anand K 2020-2026