The before-C language¶
Once upon a time there was a language called BCPL. Here’s the introduction from Wikipedia:
BCPL (“Basic Combined Programming Language”) is a procedural, imperative, and structured programming language. Originally intended for writing compilers for other languages, BCPL is no longer in common use. However, its influence is still felt because a stripped down and syntactically changed version of BCPL, called B, was the language on which the C programming language was based. BCPL introduced several features of many modern programming languages, including using curly braces to delimit code blocks. BCPL was first implemented by Martin Richards of the University of Cambridge in 1967.
I’ve written quite a bit of BCPL code (in the 70’s, on PDP-11 and CDC-64001). It’s an interesting language, due to the simplicity of the language, but also because the compiler for it was itself written in BCPL, small, and … understandable.
One of the defining features of BCPL is that it’s typeless: everything is a “word” (which can be 16, 32, or 64 bits wide these days). The distinction of whether to treat a word as an integer or a pointer is made in the context of its use. That gives it some of the same feel as FORTH, albeit with a more high-level notation and structure, and more (by now) “traditional” semantics.
Also from that era comes an operating system called TRIPOS, which illustrates the main concepts of a pre-emptive and portable O/S, as TRIPOS was (mostly) implemented in BCPL.
BCPL and TRIPOS are still available online from Martin Richards’ home
page, in the form of a (very
portable) cintsys
interpreter which uses cintcode
as compact bytecode
format. There are (somewhat ageing) code backends to generate machine code for
various architectures. And TRIPOS lives on as cintpos
with a similar
interpreter / virtual machine. All the software is freely available for personal
and educational use (this predates today’s licensing shenanigans).
Here’s an example program, using BCPL’s fairly common indentation style:
GET "libhdr"
LET start() = VALOF { writef("Hello, %s!*n", "World")
RESULTIS 0
}
I’ve dabbled in BCPL a few times over the years … it’s tempting to look into it again.
-
The Control Data 6400 had roughly the power of an Intel 386+387. ↩