CPL, BCPL, B - the origins of C

Nice history article here, from Strachey and Titan, via Wilkes, to Richards and then Ken Thompson. More links and video within.

CPL was a step too far: a new language when none was needed. “We thought this was an opportunity to have fun with a new language—which, in hindsight, was a damn stupid thing to do.” But the report on existing languages deliberately under-rated them.

Wilkes required an analysis of available programming languages before approving a proposal to develop a new language. “We chose them very carefully,” Hartley said, “in order to decide that none of them were suitable.” Notably, the working group evaluated Fortran IV without consulting Fortran users at Cambridge who could have explained the additional features included with other varieties of Fortran. Because of this, Hartley recalled the group being convinced that “we could easily define and develop something significantly better,” before noting, “this failing came home to roost in a few years.”

…it was socially acceptable to “prowl around” the MIT mainframes looking at other projects, and this was how [Ken] found both the code and documentation for BCPL…
Thompson took his copy of BCPL—which was CPL with reduced functionality—and further compressed it so that it would fit into the available 4k of memory on the PDP-7. In the course of doing this, he borrowed from a language he had encountered while a student at the University of California, Berkeley. That language, “SMALGOL,” was a subset of ALGOL 60 designed to run on less powerful computers.

The language that Thompson eventually ended up using on the PDP-7 was, as he described it to Ars, “BCPL semantics with a lot of SMALGOL syntax,” meaning that it looked like SMALGOL and worked like BCPL. Because this new language consisted only of the aspects of BCPL that Thompson found most useful and that could be fit into the rather cramped PDP-7, he decided to shorten the name “BCPL” to just “B.”

3 Likes

Looking for SMALGOL I notice you had a lot of compilers in the early 60’s created,
made a footnote in some computer paper, and totaly forgtton when
the host machine got replaced or updated, and all soure code lost
or thrown out. Compilers were said to slow, but when you use a serial
drum based computer,what do you expect for speed?

1 Like

I note that this story is somewhat different from the story that Thompson told at VCF East 2019, when he claimed that he started from Fortran, not from BCPL; I suspect that, as with all large undertakings, the truth is complicated!

(The interview starts 8-10 minutes in, C is somewhat later.)

1 Like

Oh, it’s awkward to have two versions of a history! That bit appears about the 41min mark of the video…

See also this interview transcript from '89…

Thompson: After UNIX was up, or, simultaneous with UNIX coming out, BCPL was just emerging and that was a clear winner with both of us. Both of us were really taken by the language and did a lot of work with it.

MSM: How did you come up with it, it’s an English language wasn’t it?

Thompson: Ah yes, but the guy who did, Martin Richards, actually developed it at MIT. It was available in a very informal way, on CTSS and we pulled it off of CTSS and got a version running on GECOS here and did system programming there. It was too big a language to run on the UNIX machines that were 4K machines. That’s when B was developed. Which was …

MSM: Did you develop B?

Thompson: I did B.

MSM: As a subset of BCPL

Thompson: It wasn’t a subset. It was almost exactly the same. It was a interpreter instead of a compiler. It had two passes. One went into intermediate language and which one was the interpreter of the intermediate language. Dennis wrote a compiler for B, that worked out of the intermediate language.

1 Like

I thought the Fortran thing came after in an effort to allow people without access to Unix and C to benefit from their “Software Tools” system. It was a preprocessor called Ratfor (Rational Fortran) that allowed you to write in a C style and feed the transformed result into your regular Fortran compiler.

Ratfor was Kernighan and … Plauger? I’m not sure Thompson was involved.

This is also interesting, from Dennis Ritchie:
Five Little Languages and How They Grew: Talk at HOPL

Bliss, Pascal, Algol 68, BCPL, C. All these were developed in more or less the same period. I’m going to argue that they’re very much similar in a lot of ways. And each succeeded in various ways, either by use or by influence

Edit: and this classic also by Ritchie:
The Development of the C Language

B can be thought of as C without types; more accurately, it is BCPL squeezed into 8K bytes of memory and filtered through Thompson’s brain.

1 Like