I've always kinda wondered that myself? What came first, the language or the compiler for the language? And if the compiler...well....chicken and the egg?
The first general purpose computer, ENIAC, had several walls of switchboards. Programming logic was expressed by how you physically connect these switchboards. To run a different program, you had to rewire the machine, which took days and was error-prone.
The first stored-program computer was the Baby from Manchester University (where I graduated!). "Stored" in the sense that the logic now exists as a list of instructions, each represented by a series of 0s and 1s, in the memory. These instructions are in machine code, and could be understood by the CPU (or the simpler ALU in the case of Baby), ie, the CPU has hardware circuits that do different things given different instructions. Programs were entered by using a panel of switches to individually set each bit of the memory.
Next in line was the EDSAC from Cambridge, the first computer to use a punched tape. By this time you no longer have to flip switches to modify a program.
Each instruction in the machine code usually has three parts: operation code, address, and flags. These are represented by a fixed-length list of 0s and 1s. In the case of EDSAC, the first five bits are the op-code, the next one is unused, followed by 10 bits of address, then 1 bit of a flag, making up a total of 17 bits. For example, 11100 0 000000010 0 means to add the number at memory address 000000010 to a register (a place to store an intermediate value).
As mentioned before, in Baby you'd set each bit separately. In EDSAC, you prepare the punched tape in a slightly different format. Each row in the tape has five locations that could be punched, corresponding to five bits in the instruction. The op-code occupies one row, the address two rows, and the single bit flag occupies one row on its own. So the above instruction becomes this on the tape:
11100
00000
00010
01100
Because this is rather hard to read or remember, the Cambridge folks designed a mnemonic so that the above can be written as A2S, where A is the op-code, 11100; 2 is the decimal form of the binary 000000010; and S (01100) is the code for value 0 for the flag. This was the origin of assembly language. In general, assembly code is just a more readable way of writing machine code.
When you feed the punched tape to EDSAC, the tape reader translates the four rows of holes and not-holes into twenty 1s and 0s. A special program already loaded into the machine, called the Initial Orders, would then translate the twenty bits into 17 bits of instruction. This program in some sense was the first assembler, although much of the translation, e.g. from A to 11100, was done by the programmer when he punched the tape.
For the next twenty-odd years, many programs were entered to a computer using some sort of punch cards. Each card is a grid of punching locations. The most popular version, designed by IBM, has 80 columns, representing one line of code with 80 characters. This allowed input of free text, and with it, higher level programming languages. One line of code in such languages translates to quite a few in machine language. This translation is the job of the compiler. The compiler has to be loaded to the machine first, then you run your punch cards through it. The first compiler would have to be written in some other language, for example assembly. Later iterations of the compiler may be written in the same language, and you can use a previously built compiler to compile a new version. This is called bootstrapping.
On-screen text editors were not invented until late 60s, when time-sharing operating systems were developed, allowing multiple users to use one mainframe computer at the same time. The most famous early editor, ed, was designed as part of the first Unix system, alongside the C programming language. This was pretty much the beginning of modern coding, where you sit in front of a screen, type in your program, compile and run it using just your keyboard.