3 ms·
Think of a compiler as a program that: - takes source code in one language as an input, and - turns the input into an assembly language output. Now, ignoring
by yason 16y ago
Think of a compiler as a program that:
- takes source code in one language as an input, and
- turns the input into an assembly language output.
Now, ignoring the specifics of the input language and whether the assembly output is in fact bytecode for some interpreter or JIT compiler, or machine code for a CPU, this is a quite well-specified procedure.
Such a feat can surely be accomplished in any language. Source code in, binary instructions out—how hard is that?
If the input happens to be the compiler source code itself, that doesn't really matter. The same translation occurs.
If the language used to write the compiler is the same as the compiler itself takes as input, that doesn't really matter.