Web (programming system): Difference between revisions

From Wikipedia, the free encyclopedia
Jump to navigation Jump to search
imported>ReadOnlyAccount
Implementations: traditional style here, to fit TANGLE and WEAVE nearby
 
imported>BunnysBot
Fix CW Errors with GenFixes (T1)
 
Line 4: Line 4:
{{primary sources|date=October 2017}}
{{primary sources|date=October 2017}}


'''Web''', traditionally styled WEB, is a [[computer programming]] system created by [[Donald E. Knuth]] as the first implementation of what he called "[[literate programming]]": his idea that one could create [[software]] as works of [[literature]], by embedding [[source code]] in descriptive text, rather than the reverse. Unlike standard programming practice which relegates documentation to comments, the WEB approach is to write an article to document the making of the source code, and to include all the source code in that article, so as to be compilable therefrom.
'''Web''', traditionally styled WEB, is a [[computer programming]] system created by [[Donald Knuth]] as the first implementation of what he called "[[literate programming]]":<ref>{{Cite web |title=Knuth and Levy: CWEB |url=https://cs.stanford.edu/~knuth/cweb.html |access-date=2025-10-27 |website=cs.stanford.edu}}</ref> his idea that one could create [[software]] as works of [[literature]], by embedding [[source code]] in descriptive text, rather than the reverse. Unlike standard programming practice which relegates documentation to comments, the WEB approach is to write an article to document the making of the source code, and to include all the source code in that article, so as to be compilable therefrom.


==Philosophy==
==Philosophy==
Line 12: Line 12:


==Implementations==
==Implementations==
The original WEB system [[dependency|depends]] on [[Pascal programming language|Pascal]] and comprises two programs:  
The original WEB system [[Dependency (computer science)|depends]] on [[Pascal programming language|Pascal]] and comprises two programs:


* TANGLE, which produces compilable Pascal code from the source texts, and  
* TANGLE, which produces compilable Pascal code from the source texts, and  
Line 24: Line 24:


==CWEB==
==CWEB==
{{unreferenced section|date=October 2025}}
{{Infobox programming language
{{Infobox programming language
| name                  = CWEB
| name                  = CWEB
Line 42: Line 44:
'''CWEB''' is a [[computer programming]] system created by [[Donald Knuth]] and [[Silvio Levy]] as a follow-up to Knuth's ''WEB'' [[literate programming]] system, using the [[C (programming language)|C programming language]] (and to a lesser extent the [[C++]] and [[Java (programming language)|Java]] programming languages) instead of [[Pascal (programming language)|Pascal]].
'''CWEB''' is a [[computer programming]] system created by [[Donald Knuth]] and [[Silvio Levy]] as a follow-up to Knuth's ''WEB'' [[literate programming]] system, using the [[C (programming language)|C programming language]] (and to a lesser extent the [[C++]] and [[Java (programming language)|Java]] programming languages) instead of [[Pascal (programming language)|Pascal]].


Like WEB, it consists of two primary programs:  
Like WEB, it consists of two primary programs:


* CTANGLE, which produces compilable C code from the source texts, and
* CTANGLE, which produces compilable C code from the source texts, and
Line 49: Line 51:
===Features===
===Features===
* Can enter manual TeX code as well as automatic.
* Can enter manual TeX code as well as automatic.
* Makes formatting of C code suitable for [[pretty printing]].
* Makes formatting of C code suitable for [[pretty-printing]].
* Can define sections, and can contain documentation and codes, which can then be included into other sections.
* Can define sections, and can contain documentation and codes, which can then be included into other sections.
* Writes the header code and main C code in one file, and can reuse the same sections, and then it can be tangled into multiple files for compiling.
* Writes the header code and main C code in one file, and can reuse the same sections, and then it can be tangled into multiple files for compiling.

Latest revision as of 16:20, 18 November 2025

Template:Short description Script error: No such module "Distinguish". Template:Redirect-several Script error: No such module "Unsubst".

Web, traditionally styled WEB, is a computer programming system created by Donald Knuth as the first implementation of what he called "literate programming":[1] his idea that one could create software as works of literature, by embedding source code in descriptive text, rather than the reverse. Unlike standard programming practice which relegates documentation to comments, the WEB approach is to write an article to document the making of the source code, and to include all the source code in that article, so as to be compilable therefrom.

Philosophy

The common practice in most programming languages is that the primary text is source code, optionally supplemented by descriptive text in the form of comments. Knuth proposed that making the descriptive text primary was putting things in an order more convenient for human readers, rather than the order demanded by compilers.[2]

Much like TeX articles, the Web source text is divided into sections according to documentation flow. For example, in CWEB, code sections are seamlessly intermixed in the line of argumentation.[3]

Implementations

The original WEB system depends on Pascal and comprises two programs:

  • TANGLE, which produces compilable Pascal code from the source texts, and
  • WEAVE, which through the use of TeX produces nicely-formatted, printable documentation from the same source texts.

Others:

The most significant programs written in Web are TeX and Metafont. Modern TeX distributions however use another program called Web2C to convert Web source to C.

CWEB

Script error: No such module "Unsubst".

Script error: No such module "Infobox".Template:Template otherScript error: No such module "Check for unknown parameters". CWEB is a computer programming system created by Donald Knuth and Silvio Levy as a follow-up to Knuth's WEB literate programming system, using the C programming language (and to a lesser extent the C++ and Java programming languages) instead of Pascal.

Like WEB, it consists of two primary programs:

  • CTANGLE, which produces compilable C code from the source texts, and
  • CWEAVE, which produces nicely-formatted printable documentation using TeX.

Features

  • Can enter manual TeX code as well as automatic.
  • Makes formatting of C code suitable for pretty-printing.
  • Can define sections, and can contain documentation and codes, which can then be included into other sections.
  • Writes the header code and main C code in one file, and can reuse the same sections, and then it can be tangled into multiple files for compiling.
  • Uses #line directive so that any warnings or errors refer to the .w source.
  • Include files.
  • Change files, which can be automatically merged into the code when compiling/printing.
  • Produces index of identifiers and section names in the printout.

See also

  • Documentation generators – While comparable with Web's WEAVE, these however generally follow the standard practice of source code first, the opposite of the Web approach.

References

Template:Reflist

External links

Template:TeX navbox Template:Donald Knuth navbox Template:Authority control

  1. Script error: No such module "citation/CS1".
  2. Script error: No such module "citation/CS1".
  3. Script error: No such module "citation/CS1".