Compiler History – What Came First, the Compiler or the Source?

assemblycompilerhistoryprogramming-languages

I'm curious about the birth of the compiler. How did programming begin? Did people first build hardware that recognized a certain set of commands, or did people define a language and then build hardware around it? And on a related note, what was the first programming language?

Best Answer

This has a very clear answer, actually: Source code came first – by a big margin.

Before giving the technical details, a bit of perspective:

The first programming languages were all translated into machine language or assembler by hand. The idea of using a piece of software to automate this translation (either via a compiler or evaluator) always came later, and was far from intuitive.

Consider this quote of the Wikipedia article on FORTRAN which illustrates the reluctance compilers had to face:

… the first FORTRAN compiler [was] delivered in April 1957. This was the first optimizing compiler, because customers were reluctant to use a high-level programming language unless its compiler could generate code whose performance was comparable to that of hand-coded assembly language. [emphasis mine]

=> By the time the FORTRAN compiler hit the market (1957), people were already happily programming both in assembly language and FORTRAN.

The case was similar for LISP (from Hackers & Painters):

Steve Russell said, look, why don't I program this eval …, and I said to him, ho, ho, you're confusing theory with practice, this eval is intended for reading, not for computing. But he went ahead and did it. That is, he compiled the eval in my paper into IBM 704 machine code, fixing bug, and then advertised this as a Lisp interpreter, which it certainly was. So at that point Lisp had essentially the form that it has today..."

Once again, not only does the source code (in LISP) predate the interpreter, the latter wasn’t even implicit in the former.

But these developments are relatively late. Even not considering Charles Babbage’s Analytical Engine and Ada Lovelace’s related first program, there were programming languages in the 20th century which predated compilers:

Konrad Zuse’s Plankalkül and the mathematical construct of λ-calculus introduced by Alonzo Church. Both of these are indubitably formally specified programming languages, but neither had a compiler at the time.

To put this into perspective, λ-calculus is from the 1930s, and Plankalkül was developed around 1945. By contrast, the first FORTRAN compiler came out in 1957 (but again three years after FORTRAN was specified).