Skip to content

GWEB 0.1.0

Choose a tag to compare

@sjnam sjnam released this 21 Jun 10:38

GWEB is a literate-programming system for Go, modeled closely on Knuth and
Levy's CWEB: you write one .w file interleaving TeX commentary with Go
code, and two tools turn it into a program or a typeset document.

Highlights

  • gtangle — extracts gofmt-formatted Go, expanding named sections in
    program order; supports @(file@>= multi-file output, @i includes, and
    CWEB-style .ch change files.
  • gweave — typesets a .w file as a plain-TeX document whose layout
    closely matches cweave: run-in bold section headings, bold reserved words and
    user types, italic identifiers, real math symbols, a two-column index, a
    Names of the Sections list, a contents page, and a running head. Sections (and
    code parts) are kept whole on a page.
  • Hyperlinks & bookmarks — via pdfTeX primitives, or \special{pdf:…} for the
    tex → dvipdfmx route (\let\pdf+), as in CWEB.
  • Self-hosting — GWEB is written in itself (lit/*.w); the committed Go tree
    is byte-for-byte reproducible by tangling those sources, and CI enforces the
    fixpoint along with go test, vet, and gofmt.
  • Exampleswc, pmap, seq (lazy iterators), floyd (Knuth's toy
    partition problem), and sham (a port of Knuth's Stanford GraphBase demo via
    go-sgb).
  • Tooling--version and a cweb-style startup banner, man pages, an
    install.sh (commands + gwebmac.tex + man pages), and a VS Code syntax
    highlighter (editors/vscode/).

Install

go install github.com/sjnam/gweb/cmd/gtangle@v0.1.0
go install github.com/sjnam/gweb/cmd/gweave@v0.1.0

or, for the full install (commands + gwebmac.tex + man pages), run
./install.sh from a checkout. See the README for usage.