Consider the following statements regarding the front-end and back-end of a…

2023

Consider the following statements regarding the front-end and back-end of a compiler.

S1: The front-end includes phases that are independent of the target hardware.

S2: The back-end includes phases that are specific to the target hardware.

S3: The back-end includes phases that are specific to the programming language used in the source code.

Identify the CORRECT option.

  1. A.

    Only S1 is TRUE.

  2. B.

    Only S1 and S2 are TRUE.

  3. C.

    S1, S2, and S3 are all TRUE.

  4. D.

    Only S1 and S3 are TRUE.

Attempted by 322 students.

Show answer & explanation

Correct answer: B

Final conclusion: S1 and S2 are true, and S3 is false.

  • Front-end: Handles language-specific phases such as lexical analysis, parsing, and semantic checks. These phases are independent of the target hardware (supports S1).

  • Back-end: Handles target-specific phases such as instruction selection, register allocation, and instruction scheduling. These depend on the target hardware (supports S2).

  • S3 is incorrect because phases that are specific to the programming language belong to the front-end, not the back-end.

Therefore choose the answer that states: "Only S1 and S2 are TRUE."

A video solution is available for this question — log in and enroll to watch it.

Explore the full course: Gate Guidance By Sanchit Sir