The Guy Who Wrote a Compiler Without a Compiler: Corrado Böhm

6 hours ago 2
Corrado Böhm - CompilerImage Credit – Academia Europaea

Corrado Böhm was just a postgrad student in 1951 when he pulled off something that still feels unbelievable. He wrote a full compiler by hand without using a compiler and without even having access to a proper computer.

At that time, computers weren’t easily available, especially not to students. Böhm had no machine to run or test anything, so he did everything on paper. He came up with his own language, built a model of a machine, and wrote a compiler for that language. The compiler was written in the same language it was supposed to compile, something we now call a self-hosting compiler.

The Language

The language he designed was very minimal. It only had assignment operations, no control structures, and no functions. Variables could only store non-negative integers. To perform jumps, he used a special symbol π, and for input and output, he used the symbol ?.

Even though the language was simple, it was enough to write working programs. One example from his work shows how to load an 11-element array from input using just basic assignments, jumps, and conditions. The logic may look strange today, but it worked, and it followed a clear structure that made sense for the time.
You can check out that 11-element array program on wikipedia

The entire compiler was just 114 lines of code. Böhm also designed a parsing method with linear complexity, which made the compilation process smooth for the kind of expressions his language supported. The structure of the code was clean and split logically between different types of expressions, all documented in his thesis.

Concepts like self-hosting, efficient parsing, and clean code structure all appeared in this early work. Donald Knuth, a legendary computer scientist known for writing The Art of Computer Programming, also mentioned Böhm’s contribution while discussing the early development of programming languages.

What is DSA and how to master coding skills

Read Entire Article