A new B compiler for 2019 (before C, there was B)

Robert Clausecker (of the Zuse Institute, Berlin) recently published 8bc, a B compiler for the PDP-8

Before you get too excited, this is a cross-compiler targeting the PDP-8 - not a native compiler. But it is single pass and directly emits machine code. So maybe it could serve as the basis for a native compiler.

It compiles standard B for the PDP-8/E or later computers with or without an EAE. Programs are compiled to BIN formatted tapes with an entry point at 0200.

via Oscar Vermeulen’s post to the PiDP-8 list, which includes some sample B code and an attached PDF.

More on B:
The Programming Language B [S. C. Johnson and B. W. Kernighan, 1973]
and see also mentions in
The Development of the C Language [Dennis M. Ritchie, 1993]

(B may or may not be named as a derivation from BCPL, and BCPL is a Basic version of CPL, which turned out to be too complex to implement. BCPL is still going strong! Well, there are recent BCPL programs on github, and @Revaldinho still uses it. And Martin Richards is still actively working on it.)

4 Likes

Now there is a 30 min talk by Robert (in English) about the compiler, and about B, and about the PDP-8 instruction set. From the description:

The B programming language is a simplified BCPL dialect developed at Bell Labs to program their PDP-7. Later evolving into C, B is largely forgotten but remains an important milestone that shaped the familiar syntax and basic features of many, if not most modern curly-brace languages. With 8bc, I implemented a B compiler for the PDP-8, a widely popular family of minicomputers built from 1965 until well into the early 1980s. Despite being contemporaries, B and the PDP-8 seem to never have met before. In this talk, we have a look at the unique design of the PDP-8, the concessions made in B in comparison to BCPL, and how B was implemented both historically and for comparison, in 8bc.

1 Like