This has always racked my brain. Compilers compile code. I imagine that the compiler is coded. So to actually run the code for a compiler, you'd have to compile it.
How was the first compiler compiled?
The first compiler was written in assembly for the A-0 programming language in 1952. See Wikipedia for more info.
The first compiler that could compile itself was written for and in Lisp in 1962. This is called a self-hosting or bootstrapping compiler.