Compiler textbooks rely heavily on syntax trees and state machines.

This step ensures that the components of the program fit together logically (e.g., type checking), ensuring type safety and scoping rules. 4. Intermediate Code Generation