This is the compiler bootstrapping problem. Nowadays the compilers are juste written in another language where a compiler already exist. Once the program have compiled there is no need for a compiler any longer so you can run this program without having the original compiler. This is how you can create an independent compiler. Some procramming languages can also be interpreted, where you need the interpreter to run it. So you can write a compiler, run it in the already existing interpreter, and have it compile itself.
In the old days, when compilers were still quite rare. You could write machine code directly, or partially helped by existing tools. There are several such known projects where a compiler were first compiled to machine code by hand. Once the first hand written copy was down you could use this to compile the code properly.
Latest Answers