Skip to content

Instantly share code, notes, and snippets.

@jmewes jmewes/ Secret
Created Jun 2, 2018

What would you like to do?
Literate Programming

Donald Knuth, 2016, R Conference


  • consider computer programs as literature

  • idea is to find the best way to explain a program to a human being

  • writing a program optimized for human readability first, compiler readability second.

Basic ideas

  • publication of computer programs as a book
  • think of a program as a hypertext
  • complexity from composition of lots of small simple parts
  • Small simple modules, connected to small other modules


  • Diagrams, tables etc. can be kept beside the code
  • code may get rewritten when it is correct but difficult to explain
  • code can be understood by human beings
  • pedagogical style
  • also include design descisions
  • time saving comes from debugging through better understanding
  • May make some sort of very complex programs possible at all by reduction of congnitive load.


  • a lot more work
  • more difficult to create


A Retargetable C Compiler: Design and Implementation, Christopher Fraser

  • This book is the implementation of LCC

Understanding MP3, Martin Ruckert

  • This book includes a complete MP3 player
  • You can zoom in on all the details if you want

Physically Based Rendering, Matt Pharr, Greg Humpherys

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.