Est. 1967 Intermediate

BCPL

BCPL is a small, typeless systems language designed by Martin Richards in the 1960s, best remembered as the ancestor of B and C.

Created by Martin Richards

Paradigm Procedural, Imperative, Structured
Typing Typeless (everything is a word)
First Appeared 1967
Latest Version No formal versions; Martin Richards maintains the Cintcode BCPL distribution

BCPL (Basic Combined Programming Language) is a small, procedural systems programming language with a single data type, the machine word. Martin Richards designed it at the University of Cambridge and first implemented it in 1967. It was built to make compilers easy to write and easy to port. It is now mostly remembered as the language that led to B, and through B to C.

History & Origins

BCPL grew out of CPL (originally the Cambridge Programming Language, later the Combined Programming Language), a large language designed jointly by Cambridge and London researchers in the early 1960s. Richards worked on a CPL compiler as a research student. On his own BCPL page he describes BCPL as a simple typeless language he designed in 1966, strongly influenced by that experience. In effect he removed the features of CPL that made compilation difficult.

He implemented BCPL for the first time in the spring of 1967 while working at MIT. The first compiler ran on an IBM 7094 under the Compatible Time-Sharing System. The language was documented in the BCPL Reference Manual (Project MAC memorandum M-352, July 1967) and described to a wider audience in a 1969 Spring Joint Computer Conference paper.

The compiler was written in BCPL itself and split into two parts. A front end translated source into an intermediate code called O-code, and a machine-specific back end turned that into target code. Only the back end had to be rewritten for a new machine, which made the compiler easy to move. Around 1970 the language had been carried to a range of machines, including the Honeywell 635/645, IBM 360, PDP-10, CDC 6400 and UNIVAC 1108. The accounts I checked disagree on the exact list.

Design Philosophy

BCPL has one data type: the word. Whether a word is an integer, a character or a pointer depends only on the operator applied to it, and the language does no type checking. Richards and Whitby-Strevens describe the philosophy in their book as trusting the programmer rather than laying down restrictions: the programmer is assumed to know what they are doing.

Key Features

  • Typeless words: + treats operands as integers, ! indirects through a word as a pointer, and % gives byte access.
  • Global vector: separately compiled sections share data and routines through numbered slots in a global vector, declared in header files with GLOBAL and pulled in with GET. The programmer therefore controls linking directly.
  • Expressions and VALOF: VALOF ... RESULTIS lets a block compute a value. Conditional expressions are written a -> b, c.
  • Structured control flow: IF, TEST ... THEN ... ELSE, WHILE, UNTIL, FOR, SWITCHON, BREAK and LOOP.
  • Section brackets: BCPL used $( and $) for blocks. Braces were also accepted, and the language is sometimes described as an early brace-style language. It also had // line comments, which C did not adopt but C++ later did.
  • Portable through O-code: the compiler design described above.
GET "LIBHDR"

LET START() BE WRITES("Hello, World*N")

This follows the example given by Richards and Whitby-Strevens. With current Cintsys, the header and keywords are written in lower case.

Evolution

Later work added byte-oriented features (the % operator and bit-field selection) to cope with byte-addressed hardware, because word-only addressing had become a poor fit. Dialects and ports appeared for many machines, including, reportedly, a 1970s implementation at BBN for the PDP-11. In the mid-1980s, BCPL products reportedly appeared for home and personal computers, including Arnor’s BCPL for the Amstrad CPC and PCW (approximately 1986) and MacBCPL for the Macintosh (approximately 1985); exact dates were not verified.

Richards later developed Cintcode, a compact portable bytecode. The Cintsys and Cintpos systems that run on it are the current form of BCPL.

Relationship to B and C

Ken Thompson’s B was a stripped-down, syntactically changed derivative of BCPL, and C was in turn developed from B. Kernighan and Ritchie’s The C Programming Language names BCPL as part of C’s ancestry, and Ritchie’s essay “The Development of the C Language” discusses BCPL’s influence in detail. The Jargon File credits BCPL with an early “Hello, World!” program. I have not traced that claim to a primary source, so treat it as folklore.

Current Relevance

BCPL is not in common use. Martin Richards still distributes the Cintcode BCPL system, with source, demonstration programs and a user guide, through his Cambridge web pages. According to its distribution pages it targets Linux and other Unix-like systems, among other platforms; check the current README for supported platforms. Richards has reportedly continued to use it in his own work. It is largely a language for historians and enthusiasts, and for people who want to see the ancestor of C.

Why It Matters

  • It was a very early example of a portable compiler that produced an intermediate code, a technique that later became common.
  • Its word-oriented, minimalist design fed directly into B and C.
  • It showed that a systems language and its compiler could be small enough to move to new hardware quickly, which helped it spread across many machines.
  • Operating systems such as TRIPOS, and through it early AmigaDOS, were written in it.

Timeline

1966
Martin Richards designs BCPL, a stripped-down descendant of CPL, according to his own account
1967
Richards implements BCPL for the first time while working at MIT (Project MAC) in the spring, on an IBM 7094 under CTSS
1967
The BCPL Reference Manual is issued as Project MAC Memorandum M-352 (July)
1969
Richards presents "BCPL - a tool for compiler writing and systems programming" at the Spring Joint Computer Conference
1974
The BCPL Reference Manual is republished as MIT Project MAC technical report MAC TR-141 (Richards, Evans and Mabee)
1979
Richards and Colin Whitby-Strevens publish the book BCPL: The Language and its Compiler (Cambridge University Press; some catalogues list 1980 or 1981 for later printings)
1985
MacBCPL is reportedly released for the Apple Macintosh by Topexpress Ltd
1986
Arnor Ltd reportedly releases BCPL for the Amstrad CPC and PCW (date approximate)

Notable Uses & Legacy

TRIPOS

A portable operating system written largely in BCPL, developed at Cambridge under Martin Richards' direction

AmigaDOS

The early Amiga disk operating system was derived from TRIPOS and was largely written in BCPL

Xerox PARC Alto

BCPL was reportedly an early systems language on the Alto, and the Bravo document preparation system is generally said to have been written in it

MUD1

The first multi-user dungeon, created at the University of Essex, was originally written in MACRO-10 assembly and later reportedly rewritten in BCPL

BCPL compiler and Cintcode system

The BCPL compiler is itself written in BCPL, and Richards still distributes a portable Cintcode interpreter version

Language Influence

Influenced By

CPL

Influenced

Running Today

Run examples using the official Docker image:

docker pull
Last updated: