Question: 1. Compiler Architecture Question 1.1 (3 points). Compilers typically separate the frontend (lexing, parsing, semantic analysis, IR generation) and the backend (code generation) to enable
1. Compiler Architecture
Question 1.1 (3 points). Compilers typically separate the frontend (lexing, parsing, semantic analysis, IR generation) and the backend (code generation) to enable reuse and composition. Find a real-world example, where one frontend targets multiple backends. Find a real-world example, where multiple frontends target the same backend.
Question 1.2 (3 points). Many compilers have multiple optimizers, at different stages in the pipeline. Why is that useful? Find a real-world example of optimization at different stages.
Question 1.3 (3 points). Many compilers use two main intermediate representations usually trees and some intermediate language. Some compilers go further and introduce more levels of IR. Why is that useful? Find a real-world example of an extra IR (in addition to trees and some intermediate language).
Question 1.4 (3 points). Some compilers translate a high-level language to another high-level language rather than assembly, virtual machine code, or machine code. What specific language is a common target for such compilers and why?
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
