It’s the technique used to create a compiler of a specific language written in the same language. (chicken or the egg dilemma)
What is given
- CPU (understands machine code)
- Assembler (translates assembly language into machine code)
Assembly Language → Assembler → Machine Code → CPU
How it’s solved
Let’s assume you have designed a new language called ABC.
- The first ABC compiler (v1) has to be written in assembly language (or machine code).
- Now you can use this ABC compiler (v1) to compile an ABC compiler (v2) written in ABC.
- Finally, you can use the ABC compiler (v2) to compile its own source code. (self-compiled)
ABC Compiler v1 (written in Assembly)
│
│ compiles
▼
ABC Compiler v2 (written in ABC)
│
│ compiles itself
▼
ABC Compiler v3 (self-compiled)