Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

Web (programming system)

From Wikipedia, the free encyclopedia
(Redirected fromCWEB)
Macro-based programming language
Not to be confused withWorld Wide Web.
Several terms redirect here. For other uses, seeTangle (disambiguation), Weave (disambiguation), and Web (disambiguation).
This articlerelies excessively onreferences toprimary sources. Please improve this article by addingsecondary or tertiary sources.
Find sources: "Web" programming system – news ·newspapers ·books ·scholar ·JSTOR
(October 2017) (Learn how and when to remove this message)

Web, traditionally styled WEB, is acomputer programming system created byDonald Knuth as the first implementation of what he called "literate programming":[1] his idea that one could createsoftware as works ofliterature, by embeddingsource 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

[edit]

The common practice in mostprogramming 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 bycompilers.[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

[edit]

The original WEB systemdepends onPascal and comprises two programs:

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

Others:

The most significant programs written in Web areTeX andMetafont. Modern TeX distributions however use another program calledWeb2C to convert Web source to C.

CWEB

[edit]
icon
This sectiondoes notcite anysources. Please helpimprove this section byadding citations to reliable sources. Unsourced material may be challenged andremoved.(October 2025) (Learn how and when to remove this message)
CWEB
ParadigmLiterate,imperative (procedural),structured
Designed byDonald Knuth
DeveloperDonald Knuth &Silvio Levy
First appeared1987; 38 years ago (1987)
Stable release
3.67 / October 24, 2006; 19 years ago (2006-10-24)
Typing disciplineStatic,weak,manifest,nominal
OSCross-platform (multi-platform)
Licensecustomfree-software license
Filename extensions.w
Websitewww-cs-faculty.stanford.edu/~uno/cweb.html
Influenced by
WEB,TeX
Influenced
noweb

CWEB is acomputer programming system created byDonald Knuth andSilvio Levy as a follow-up to Knuth'sWEBliterate programming system, using theC programming language (and to a lesser extent theC++ andJava programming languages) instead ofPascal.

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 usingTeX.

Features

[edit]
  • Can enter manual TeX code as well as automatic.
  • Makes formatting of C code suitable forpretty-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

[edit]
  • 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

[edit]
  1. ^"Knuth and Levy: CWEB".cs.stanford.edu. Retrieved2025-10-27.
  2. ^Knuth, Donald E. (1992).Literate Programming. CSLI Lecture Notes. Vol. 27. Stanford, California: Center for the Study of Language and Information.
  3. ^Silvio Levy (12 June 2004)."An example of CWEB"(PDF). Archived fromthe original(PDF) on 20 October 2021.

External links

[edit]
Macro packages
Alternative TeX engines
Active
Deprecated
Distributions
Active
Deprecated
Community
Related
Publications
Software
Fonts
Literate programming
Algorithms
Other
Authority control databases: NationalEdit this at Wikidata
Retrieved from "https://en.wikipedia.org/w/index.php?title=Web_(programming_system)&oldid=1322918248#CWEB"
Categories:
Hidden categories:

[8]ページ先頭

©2009-2025 Movatter.jp