What are the three stages of a compiler?
A lesson on the-super-tiny-compiler, a GitHub repo. Computing, college level.
A compiler turns code in one language into code in another.
Most compilers do this in three stages.
First comes parsing.
Then comes transformation.
Last comes code generation.
Think of it as a line of three workers.
Each one takes what the worker before made and passes its own result on.
Our tiny compiler follows this same plan.
Questions in this lesson
- Imagine translating a book from English into Spanish. Which approach do you think works best?
- In your own words, how does a compiler turn code into other code, and how do its stages work together?