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?
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:
=> 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):
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).
The compiler was first. It was directly written in machine code, for the source could not be compiled without a compiler.
Wikipedia articles like this one about Computer Languages can answer most of the questions. If not, just pick one of the books by Tanenbaum, like Structured Computer Organization , which can answer more questions than you can even ask :)
I can not say anything more specific, for your question is too broad.
The algorithms were sorted out on paper, then the alus were wired up physically/mechanically (moving wires). to change the program you move the wires and run again.
Later the assembly language sorted out on paper, translated to machine code by hand, then using switches, etc to feed it into ram. Or punch cards, etc. Eventually you can make an assembler, then you can program in assembly not machine code, then you can make a compiler. Eventually you can bootstrap that compiler. And make new languages and new compilers, etc.
The first language was not a language, later the first language was assembly language. for every processor the first language is assembly language (derived from the machine code). The instruction set is designed first then the hardware to implement it then assembler, then compilers.
This question is pivots strongly on our semantic interpretation of 'source code'. If we define it as 'text-based computer instructions that are compiled', then presumably a compiler came first.
I'm more inclined to go with something more authoritative, such as Mark Harman's paper "Why Source Code Analysis and Manipulation Will Always Be Important" presented at the Tenth IEEE International Working Conference on Source Code Analysis and Manipulation
And I think your answer is implicit in that definition - source code most certainly came first.
Interpreters existed before compilers so source code existed before compilers.
There are some very interesting papers on the history of computing here. The source code for the FORTRAN II compiler is supposed to be available, but those links are broken.
This paper, from 1954, describes the Whirlwhind interpreter.
Programming began with people writing machine code directly into memory, onto punched cards and paper tape or even shorting links on a patch panel. Whether the hardware was built around the needs of the software or vice versa is difficult to tell. Certainly the earliest design for a turing complete programmable computer, Babbage's Analytical engine, pre-dated Ada Lovelace's first documented program.
As to the first programming language, I have argued that it was the machine language of Babbage's analytical engine (from the question What was the first programming language written for computers?)
To answer the question in your question title, since assembly language is source code, and assembly languages pre-date high level languages which could be compiled into assembler, the source code came first.
Also, a compiler has never been necessary, just convenient.
It is perfectly possible to write software directly into memory if you have memorised the appropriate op-code tables. In fact, some early computers required the user to punch in the bootstrap code on the front panel hex keypad to get them to boot, but you could tap in any code you liked and it would be run.
Admittedly as CPU's get more complex, this gets more difficult, but a simple instruction set like 6809, or Z80 (ignoring all the weird indexed modes) is relatively easy to program even without an assembler, let alone a compiler from a high level language.
If Babbage's analytical engine had ever been built, I'm sure there would have been a steampunk Mel, writing optimised programs directly onto loom cards.
protected by gnat Jun 24 '15 at 23:02
Thank you for your interest in this question.
Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site.
Would you like to answer one of these unanswered questions instead?