A developer reconstructed a working B programming language compiler — the language that preceded C and contained the first-ever 'Hello World' program written by Brian Kernighan. Since the original B compiler was lost, the author reverse-engineered it by studying surviving B binaries, standard library object code, and documentation, then built a new compiler in under 1,000 lines of B code. The implementation uses threaded/interpreted code (similar to Forth) rather than direct machine code, making it portable across PDP11, RISC-V, MIPS, x86, and PDP10. Key B features discussed include its single data type (the machine word), the `auto` keyword for stack variables (later borrowed by C++), and the `char()` function for extracting characters from strings. The project runs on a recovered Version 4 Unix image and is available on GitHub.

9m watch time

Sort: