Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Literate programming
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{Short description|A programming approach of software development}} {{Use American English|date=June 2024}} {{Use mdy dates|cs1-dates=ll|date=June 2024}} [[File:Literate Programming book cover.jpg|thumb|''Literate Programming'' by [[Donald Knuth]] is the seminal book on literate programming.]] '''Literate programming''' is a [[programming paradigm]] introduced in 1984 by [[Donald Knuth]] in which a [[computer program]] is given as an explanation of how it works in a [[natural language]], such as English, interspersed (embedded) with [[Snippet (programming)|snippets]] of [[Macro (computer science)|macros]] and traditional [[source code]], from which [[Compiler|compilable]] source code can be generated.<ref name="TCJ_LP">{{note label|TCJ_LP||v}}{{note label|TCJ_LP||w}}{{note label|TCJ_LP||x}}{{note label|TCJ_LP||y}}{{note label|TCJ_LP||z}}{{Cite journal |last=Knuth |first=Donald E. |author-link=Donald Knuth |date=1984 |title=Literate Programming |url= http://www.literateprogramming.com/knuthweb.pdf |journal=[[The Computer Journal]] |publisher=[[British Computer Society]] |volume=27 |issue=2 |pages=97β111 |doi=10.1093/comjnl/27.2.97 |access-date=January 4, 2009 |doi-access=free}}</ref> The approach is used in [[scientific computing]] and in [[data science]] routinely for [[reproducible research]] and [[open access]] purposes.<ref>{{Cite journal |last=Schulte |first=Eric |date=2012 |title=A Multi-Language Computing Environment for Literate Programming and Reproducible Research |url= https://www.jstatsoft.org/article/view/v046i03/v46i03.pdf |url-status=live |journal=Journal of Statistical Software |volume=46 |issue=3 |doi=10.18637/jss.v046.i03 |archive-url= https://web.archive.org/web/20141109113411/https://www.jstatsoft.org/article/view/v046i03/v46i03.pdf |archive-date=November 9, 2014 |access-date=May 30, 2020 |doi-access=free}}</ref> Literate programming tools are used by millions of programmers today.<ref>{{Cite conference |last=Kery |first=Mary Beth |date=April 2018 |title=The Story in the Notebook: Exploratory Data Science using a Literate Programming Tool |book-title=CHI '18: Proceedings of the 2018 CHI Conference on Human Factors in Computing Systems |publisher=[[Association for Computing Machinery]] |pages=1β11 |doi=10.1145/3173574.3173748}}</ref> The literate programming paradigm, as conceived by Donald Knuth, represents a move away from writing computer programs in the manner and order imposed by the compiler, and instead gives [[programmer]]s macros to develop programs in the order demanded by the logic and flow of their thoughts.<ref>{{block quote|I had the feeling that top-down and bottom-up were opposing methodologies: one more suitable for program exposition and the other more suitable for program creation. But after gaining experience with WEB, I have come to realize that there is no need to choose once and for all between top-down and bottom-up, because a program is best thought of as a web instead of a tree. A hierarchical structure is present, but the most important thing about a program is its structural relationships. A complex piece of software consists of simple parts and simple relations between those parts; the programmer's task is to state those parts and those relationships, in whatever order is best for human comprehension not in some rigidly determined order like top-down or bottom-up. |author=[[Donald Knuth|Donald E. Knuth]] |source=''Literate Programming''{{ref label|TCJ_LP|1|v}} }}</ref> Literate programs are written as an exposition of logic in more [[natural language]] in which [[Macro (computer science)|macros]] are used to hide abstractions and traditional [[source code]], more like the text of an [[essay]]. Literate programming (LP) tools are used to obtain two representations from a source file: one understandable by a compiler or interpreter, the "tangled" code, and another for viewing as formatted [[documentation]], which is said to be "woven" from the literate source.<ref name="ObliqueScottReference">If one remembers that the first version of the tool was called WEB, the amusing literary reference hidden by Knuth in these names becomes obvious: "Oh, what a tangled web we weave when first we practise to deceive" ββ[[Sir Walter Scott]], in Canto VI, Stanza 17 of ''[[Marmion (poem)|Marmion]]'' (1808) an epic poem about the [[Battle of Flodden]] in 1513. β the actual citation appeared as an epigraph in a May 1986 article by Jon Bentley and Donald Knuth in one of the classical "Programming Pearls" columns in ''Communications of the ACM'', vol. 29, no. 5, p. 365.</ref> While the first generation of literate programming tools were [[computer language]]-specific, the later ones are [[Language-independent specification|language-agnostic]] and exist beyond the individual programming languages.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)