Content deleted Content added
→Features: #line is a preprocessing directive in C, not a pragma |
oh what a tangled web we weave Tag: Disambiguation links added |
||
Line 4:
{{primary sources|date=October 2017}}
'''Web''' is a [[computer programming]] system created by [[Donald E. Knuth]] as the first implementation of what he called "[[literate programming]]":
==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 [[compiler]]s.<ref>{{cite book |first = Donald E. |last=Knuth |author-link = Donald Knuth |title=Literate Programming |___location=Stanford, California |publisher=Center for the Study of Language and Information |year=1992 |series=CSLI Lecture Notes |volume=27 }}</ref>
[[#CWEB|CWEB]] is a version of Web for the [[C (programming language)|C programming language]], while [[noweb]] is a separate literate programming tool, which is inspired by Web (as reflected in the name) and which is [[language-independent specification|language agnostic]].▼
==Implementations==
The most significant programs written in Web are [[TeX]] and [[Metafont]]. Modern TeX distributions use another program [[Web2C]] to convert Web source to C.▼
The original Web system [[dependency|depends]] on [[Pascal programming language|Pascal]] and comprises two programs:
* TANGLE, which produces compilable Pascal code from the source texts, and
▲==Philosophy==
* WEAVE, which through the use of [[TeX]] produces nicely-formatted, printable documentation from the same source texts.
▲Unlike most other [[Comparison of documentation generators|documentation generators]], which relegate documentation to comments, the WEB approach is to write an article to document the making of the source code. Much like TeX articles, the source is divided into sections according to documentation flow. For example, in CWEB, code sections are seamlessly intermixed in the line of argumentation.<ref>{{cite web |author=Silvio Levy |url=http://tex.loria.fr/litte/wc.pdf |date=12 June 2004 |title=An example of CWEB |archive-url=https://web.archive.org/web/20211020184416/http://tex.loria.fr/litte/wc.pdf |archive-date=20 October 2021 |url-status=dead}}</ref>
'''Others:'''
*[[#CWEB|CWEB]] (below) is a version of Web for the [[C (programming language)|C programming language]], while
▲
▲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==
Line 41 ⟶ 49:
===Features===
* Can enter manual TeX code as well as automatic.
* Make formatting of C code for [[pretty printing]].{{huh?}}
* Can define sections, and can contain documentation and codes, which can then be included into other sections.
* Write 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.
Line 48 ⟶ 56:
* 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 ==
* [[Comparison of documentation generators|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 ==
Line 64 ⟶ 75:
[[Category:Literate programming]]
[[Category:TeX]]
|