A modern compiler is typically structured in three stages: the front end, the middle end, and the back end. The front end parses the source code, checks it for correctness, and builds an intermediate representation (IR). The middle end performs optimizations on this IR. The back end then translates the optimized IR into target machine code for a specific CPU architecture.
