Questions: Compiler Bootstrapping and Self-Hosting

5 questions to test your understanding

Score: 0 / 5
Question 1 Multiple Choice

In the three-stage bootstrap chain for language X, what is the essential role of the stage-1 compiler written in language Y?

AIt serves as the permanent production compiler for language X
BIt compiles enough of X to produce a binary that can then compile the X-written compiler, breaking the circularity
CIt validates that the X-written compiler is semantically correct by comparing outputs
DIt translates the X-written compiler into assembly language for direct execution
Question 2 Multiple Choice

A compiler team compiles their compiler source with version N to produce binary N+1, then compiles the same source with binary N+1 to produce binary N+2. What property do they expect to hold, and what does a violation indicate?

ABinary N+2 should be larger than N+1, indicating the compiler is generating more optimized code
BBinaries N+1 and N+2 should be identical (fixed-point reproducibility); a difference indicates a compiler bug or nondeterminism
CBinary N+2 should be faster at runtime than N+1, since it was compiled by a better compiler
DThe source code should change between compilations as the compiler auto-optimizes itself
Question 3 True / False

A self-hosting compiler is one that can compile its own source code, meaning the language it is written in and the language it compiles are the same.

TTrue
FFalse
Question 4 True / False

When developing a new version of a self-hosting compiler, you is expected to rewrite the compiler from scratch using an external language each time, because the previous version can seldom compile new language features it doesn't yet understand.

TTrue
FFalse
Question 5 Short Answer

Explain the apparent paradox of bootstrapping — 'how can a compiler for language X be written in language X?' — and how the bootstrap chain resolves it.

Think about your answer, then reveal below.