Web (programming system)
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:
- CWEB (below) is a version of Web for the 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 agnostic.
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
| CWEB | |
|---|---|
| Paradigm | Literate, imperative (procedural), structured |
| Designed by | Donald Knuth |
| Developer | Donald Knuth & Silvio Levy |
| First appeared | 1987 |
| Stable release | 3.67
/ October 24, 2006 |
| Typing discipline | Static, weak, manifest, nominal |
| OS | Cross-platform (multi-platform) |
| License | custom free-software license |
| Filename extensions | .w |
| Website | www-cs-faculty |
| Influenced by | |
| WEB, TeX | |
| Influenced | |
| noweb | |
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
#linedirective 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
- ^ "Knuth and Levy: CWEB". cs.stanford.edu. Retrieved 2025-10-27.
- ^ Knuth, Donald E. (1992). Literate Programming. CSLI Lecture Notes. Vol. 27. Stanford, California: Center for the Study of Language and Information.
- ^ Silvio Levy (12 June 2004). "An example of CWEB" (PDF). Archived from the original (PDF) on 20 October 2021.
External links
- The TeX Catalogue entry for Web
- CWEB homepage
- Examples of programs written in Web, By Donald Knuth (1981 and onward)
Content Disclaimer
Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.
- The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
- There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
- It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
- Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
- Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.