
Literate programming
by Donald Knuth · first published 1992
128mentions
18recommended by
94HN commenters
2009–2026first – last mentioned
19% recommend78% neutral3% critical
Why HN recommends it
Knuth's case for writing programs as readable prose for humans, with tangle/weave tooling. Readers value it for shaping how they write code, and for the essay The Errors of TeX on how TeX was built.
Summarised by Claude from recommending comments
Affiliate links. As an Amazon Associate I earn from qualifying purchases.







…started writing it he realized the students' proto-TeX was an impressive effort, because there was a lot missing from his specifications. Knuth's article The Errors of TeX (reprinted in his collection Literate Programming) goes into excellent detail on the development process. Also: a suggestion to try plain TeX (instead of LaTeX), if you haven't tried it. The book A Beginner's Book of TeX by Seroul and Levy is especially…
on “The lingua franca of LaTeX” ↗…massive in scope and it's one man putting it all together. However, those aren't his only books. Concrete Mathematics is a completed text that expands on, in particular, the math in Chapter 1 of TAOCP. Literate Programming is a collection of papers on topics in programming, and is the first of eight such books. If you want interesting but mildly impractical, check out his Computers & Typesetting [0] which includes two books…
on “Ask HN: Most interesting, mildly impractical, well-written books on software?” ↗Literate Programming, Knuth. My methods have evolved since I first read and started toying with the ideas here, but this is where it started. http://www-cs-faculty.stanford.edu/~uno/lp.html
on “Ask HN: What books had the greatest effect on how you structure your code?” ↗If you're not familiar w/ TeX, and if _The Art of Computer Programming_ seems tough sledding (but interesting), may I suggest: https://www.amazon.com/Literate-Programming-Lecture-Notes-Do... You could check out: http://literateprogramming.com/ to see if it's a good fit. Hopefully it will get reprinted soon, but there are still copies available at fairly reasonable prices.
on “Ask HN: Best value Comp. Sc. book for 100€?” ↗Knuth? He has argued in the past that the concept of Literate Programming http://literateprogramming.com/ is the most important work he has done, and I highly recommend his various collections of lecture notes/papers including: https://www.goodreads.com/book/show/112245.Literate_Programm...
on “Clean Code vs. A Philosophy Of Software Design” ↗> I thought Knuts Literate Programming book (https://www-cs-faculty.stanford.edu/~knuth/lp.html) was extremely interesting, the paper "the errors of TeX" which is a part of it is one of the more interesting papers I've read. I haven't read…
on “Ask HN: Most interesting, mildly impractical, well-written books on software?” ↗…using them to capture the good ideas of Xanadu. >Has Xanadu been used to document its own source code? How does it compare to, say, the browseable cross-referenced mozilla source code? Or Knuth's classic Literate Programming work with TeX? >Last time I saw Ted Nelson talk (a few years ago at Ted Selker's NPUC workshop at IBM Almaden), he was quite bitter, but he didn't have anything positive to contribute. He talked about…
on “Ted Nelson on What Modern Programmers Can Learn from the Past [video]” ↗I thought Knuts Literate Programming book (https://www-cs-faculty.stanford.edu/~knuth/lp.html) was extremely interesting, the paper "the errors of TeX" which is a part of it is one of the more interesting papers I've read. Joe Armstrong…
on “Ask HN: Most interesting, mildly impractical, well-written books on software?” ↗…The Connection Machine Kernighan and Pike, The Practice of Programming Kernighan and Pike, The Unix Programming Environment Kernighan and Plauger, Software Tools in Pascal Donald Knuth, Literate Programming Glenn Krasner (editor), Smalltalk-80: Bits of History, Words of Advice Susan Lammers, Programmers at Work Wm Leler, Constraint Programming Languages Liskov and Guttag, Abstraction and…
on “Which programming book you just couldn’t stop reading from start to end?” ↗Have you tried reading other people's code? There's Knuth Literate Programming version of the classic Adventure [0] which you can read almost like a novel, and the source code for Spelunky [1] has also been released [2]. (I don't know whether Spelunky has good code, but it's a…
on “My first six months of programming: from man-rodent to partyman” ↗…comment about my C version. I wanted to make sure it was extensible and quite obvious -- because I write code to be read by humans as my 2nd goal (my first is that it works & meets the spec!). Knuth's Literate Programming taught me that. The other thing about that C solution is that it's simple and many people can understand it. One does not need to know the difference between a monad and a gonad to "get it". My overall…
on “Fizzbuzz, Interviews, And Overthinking” ↗Donald Knuth, "Literate Programming", tangle/weave (https://en.wikipedia.org/wiki/Literate_programming). The same source can produce compilable code, or formatted comments.
on “Ask HN: What are some examples of good code?” ↗Agreed and Knuth's Literate Programming. Our industry is caught in the event horizon of the black hole named, "cargo cults".
on “Harder programming questions do a worse job of predicting outcomes” ↗Wow, this is embarrassing. I've read plenty of Inform 7 source code (see e.g. https://github.com/i7/counterfeit-monkey/blob/master/Counter... ). And I read Knuth's book "Literate Programming" in formative years and loved the idea. But somehow I never connected Inform 7 as generically a live, working modern example of literate programming. That's pretty silly! The language is full of dozens…
on “Open-Sourcing Inform 7” ↗I just happened to be reading up on Readme Driven Development[0] last night and the HN thread[1] had a few mentions of Donald Knuth's Literate Programming[2]. Fascinating read. [0]: https://tom.preston-werner.com/2010/08/23/readme-driven-deve... [1]: https://news.ycombinator.com/item?id=17427593 [2]: https://en.wikipedia.org/wiki/Literate_programming
on “Write documentation first, then build” ↗