Classic BCPL

BCPL was apparently first implemented by Martin Richards at MIT around 1967, and was a widely-used systems programming language during the 1970s. However, it is chiefly remembered nowadays, because it directly inspired the programming language B, which in turn gave rise to the immensely successful language C.

To anyone interested in the whys and wherefores of C, a passing acquaintance with BCPL is worthwhile. Viewed forwards through BCPL, rather than backwards through Java and C++, many C constructs, and idiomatic C ways of doing things, just make a lot more sense.

Beyond its historical importance, BCPL had intrinsic merits. In retrospect, what particularly impresses, is the elegant simplicity of its compiler. This is well documented in the book BCPL: the language and its compiler by Martin Richards and Colin Whitby-Strevens (Cambridge: Cambridge University Press, 1979).

In its heyday, a great virtue of BCPL was portability. Through the use of INTCODE (a simple assembly language for an abstract machine), the problem of first bringing up the compiler on a new platform was reduced to that of coding an interpreter in some available high level language. Such a task might take only a day or two.

The pages here focus on "classic" BCPL as it was around 1979, and the implementations are very close to that described in the BCPL book.

The distribution obcpl presents a BCPL compiler together with a brand-new backend generating native x86 code and supplied with library code providing runtime support. This is a distribution suitable for compiling and running a range of older BCPL programs on 64-bit and 32-bit Linux and FreeBSD systems.

An earlier distribution bcplkit presents the Cambridge BCPL porting kit, with an INTCODE interpreter and an INTCODE to x86 code generator. Again, the primary version is for FreeBSD and Linux systems. This is a less capable compiler, and the obcpl distribution is to be preferred unless you are interested in INTCODE specifically.

Also available is the archive bcpltape which includes the original BCPL distribution files, dating from the early 1980s. These are the raw materials that the other distributions make use of.

You can also look at a sample BCPL program.

Available Elsewhere

The Classic BCPL for Windows distribution from David Cannon makes use of portions of the software supplied here, and is a simple solution to the problem of compiling old BCPL programs on that platform.

Martin Richards, the originator of BCPL, has continued to develop BCPL, very much as though it were still a living language, and has a large and complex distribution of "present day" BCPL available, together with some archive materials, at his home page.