inweb: The Program


Build 4/090319

Graham Nelson

inweb PDF
(152pp, 544KB)

A simple literate programming tool intended for medium-sized and large programs.

This is a free, open-source program published under the Artistic License 2.0.

Preliminaries  (20pp, 153KB)  


The inweb Manual  (P/man: 19pp, 148KB)

File (1329 lines) 

PDF (19pp, 148KB) 

A manual for inweb, a simple literate-programming tool used by the Inform project.

Chapter 1: Top Level  (14pp, 119KB)  


Dealing with the user, and deciding what is to be done.

Program Control  (1/pc: 7pp, 94KB)

File (276 lines) 

PDF (7pp, 94KB) 

The top level, which decides what is to be done and then carries this plan out.

Command Line and Errors  (1/cli: 6pp, 80KB)

File (282 lines) 

PDF (6pp, 80KB) 

To parse the command line arguments with which inweb was called, and to handle any errors it needs to issue.

Chapter 2: Parsing a Web  (46pp, 236KB3 TeX error)  


Reading in the entire text of the web, parsing its structure and looking for identifier names within it.

Reading Sections  (2/read: 8pp, 104KB)

File (379 lines) 

PDF (8pp, 104KB) 

To read the Contents section of the web, and through that each of the other sections in turn, and to collate all of this material into one big linear array of source-code lines.

Line Categories  (2/lcats: 2pp, 47KB)

File (82 lines) 

PDF (2pp, 47KB) 

We are going to need to identify lines of source code as falling into 18 different categories -- the start of a definition, a piece of a comment, and so on. In this section we define constants to enumerate these categories, and provide a debugging routine to show the classification we are using on the web we've just read.

The Parser  (2/parse: 12pp, 115KB)

File (586 lines) 

PDF (12pp, 115KB) 

To work through the program read in, assigning each line its category, and noting down other useful information as we go.

Identifiers  (2/ident: 23pp, 159KB)

File (1113 lines) 

PDF (23pp, 159KB) 

To find the identifier names of functions and structures, and monitor in which sections of the program they are used; and so to police the accuracy of declarations at the head of each section.

Chapter 3: Outputs  (75pp, 306KB)  


Either weaving part or all of the web into a typeset form for human eyes (or a swarm of many such parts), or tangling the web into an executable program, or analysing the web to provide diagnostics on it.

The Analyser  (3/anal: 7pp, 86KB)

File (306 lines) 

PDF (7pp, 86KB) 

Miscellaneous useful (or anyway, formerly useful) checks to carry out on the source code.

The Swarm  (3/swarm: 14pp, 117KB)

File (645 lines) 

PDF (14pp, 117KB) 

To feed multiple output requests to the weaver, and to present weaver results, and update indexes or contents pages.

The Weaver  (3/weave: 18pp, 136KB)

File (871 lines) 

PDF (18pp, 136KB) 

To weave a portion of the code into instructions for TeX.

Backus-Naur Form  (3/bnf: 10pp, 94KB)

File (454 lines) 

PDF (10pp, 94KB) 

To weave any collated BNF grammar from the web into a nicely typeset form.

The Tangler  (3/tang: 8pp, 107KB)

File (386 lines) 

PDF (8pp, 107KB) 

To write a portion of the code in a compilable form.

Programming Languages  (3/plan: 5pp, 75KB)

File (200 lines) 

PDF (5pp, 75KB) 

To characterise the relevant differences in behaviour between the various programming languages we support: for instance, how comments are represented.

C for Inform  (3/cfori: 12pp, 110KB)

File (611 lines) 

PDF (12pp, 110KB) 

To provide a convenient extension to C syntax for the C-for-Inform language, which is likely never to be used for any program other than the Inform 7 compiler.

This is a "web", a term invented by Donald Knuth in the early 1980s for a program written according to the heavily annotated literate programming dogma. For more on "inweb", visit the Inform 7 project.