Go to the first, previous, next, last section, table of contents.
@FWEB{} is a system for literate programming. It enables one to
maintain both documentation and source code in a single place (the
web
file), and to explain the code in terms of a web of
very small fragments. Because @FWEB{} is intimately integrated with
TeX, one gains many advantages such as book-quality typesetting and
extensive cross-referencing facilities. A simple example program is
described in section The structure of a web.
@FWEB{} was originally intended for scientific programming (the 'F' stands for FORTRAN), and is in wide use in that arena; however, it has much broader applicability. It is an extension of Knuth's WEB system that handles the specific languages C, C++, Fortran (both F77 and F90), RATFOR, and (in a limited fashion) TeX itself. It also attempts to implement a WYSIWYG language-independent mode as well as a (closely-related but not identical) verbatim `language'. The language-independent features are highly experimental and are not recommended.
The origins and philosophy of literate programming are described in the very enjoyable book by D. E. Knuth, Literate Programming (Center for the Study of Language and Information, Leland Stanford Junior University, 1992).
Knuth's original WEB was written in Pascal, and it formatted Pascal code. Silvio Levy introduced CWEB, a WEB system written in C for C. @FWEB{} is a (by now, substantial) modification of version 0.5 of CWEB that was graciously supplied by Levy. It also borrows various ideas from the works of Ramsey and Briggs on language-independent webs.
The original WEB's worked with Plain TeX. More recently, many users have turned to Lamport's LaTeX because of its ease of use and higher-level features. Excellent and extensive development of LaTeX has been accomplished, as described by Goossens, Mittelbach, and Samarin, The LaTeX Companion (Addison--Wesley, Reading, MA, 1994). The present version of @FWEB{} is intended to be used with LaTeX (LaTeX2e, in particular); Plain TeX is no longer supported.
(To be completed; see Knuth's book, cited in section INTRODUCTION to @FWEB{}.)
@FWEB{} is distinguished from its relatives in several respects:
- @FWEB{} introduces the concept of a current language (see section LANGUAGES), so more than one compiler language can be processed in a single @FWEB{} run. For example, mixtures of C++ and FORTRAN are common in modern scientific programming.
- @FWEB{} understands the syntaxes of several of the more important compiler languages: C, C++, FORTRAN (both F77 and F90), RATFOR, and TeX. For other languages, @FWEB{} can work in a language-independent mode that essentially weaves and tangles the source code verbatim, but still provides the user with the powerful WEB features related to TEX documentation, module names, macro processing, etc.
- @FWEB{} contains a built-in RATFOR (RATIONAL FORTRAN) translator. See section RATFOR.
- @FWEB{} has a built-in C-like macro preprocessor. This is especially useful for FORTRAN and RATFOR, which have no predefined preprocessor. However, certain extensions such as variable numbers of arguments make the @FWEB{} preprocessor sometimes useful even for C and C++. See section MACROS and PREPROCESSING and section Preprocessing.
- Many aspects of @FWEB{}'s behavior, default strings, etc. can be customized by means of setting parameters in a
makeindex
-like style file (by default, `fweb.sty'). See section The Style file.
Go to the first, previous, next, last section, table of contents.