Intermediate Code Generation via an Abstract Machine Model (Choose the Correct Answer)

Intermediate Code Generation via an Abstract Machine Model (Choose the Correct Answer)

Verified Sources
Nov 3, 2026

In compiler design, an intermediate code (often called an intermediate representation, IR) can be generated using an abstract machine model. This approach is useful because it separates concerns: the compiler’s front-end can be made (largely) machine-independent, while the back-end focuses on mapping the intermediate code to specific target machines. This separation increases portability of the front end and lets compiler writers change targets without rewriting the entire compiler.

In typical compiler theory, syntax-directed translation rules are indeed used to translate parse tree information into intermediate code, but among the given options, the strongest and most directly stated rationale for using an abstract machine model is enhanced portability of the front end.

Mermaid concept map:

Compiler Phases & Intermediate Representation (IR) Explained

Choosing the correct option (i)–(iv)

We evaluate each statement against the role of an abstract machine model in intermediate code generation:

  • (i) syntax-directed translations can be written for intermediate code generation
    True in general: intermediate code is commonly produced via syntax-directed translation because the compiler has a parse tree/grammar structure.
    However, this is more about how to generate intermediate code (a technique), not the specific benefit tied to the abstract machine model approach.

  • (ii) to generate code for real machines directly from high-level language program is not possible
    Not a good compiler-theory reason: direct code generation from high-level code to real machine code is possible (modern compilers do it via multiple internal phases). So the statement is not correct as a theoretical necessity.

  • (iii) portability of the front end of the compiler is enhanced ✅
    This is the primary textbook justification: using an abstract machine model for IR keeps the front-end largely independent from the target architecture, while only the back-end changes.

  • (iv) implementation of lexical and syntax analyses is easier
    Incorrect: lexical/syntax analysis complexity is about the language grammar and scanning strategy, not about choosing an abstract machine model for IR.

Therefore, the correct answer is: (iii) portability of the front end of the compiler is enhanced.

Exam strategy

When options mention abstract machine model or intermediate code, prioritize the answer about machine independence (portability) rather than about scanning/parsing details.

How to justify the correct choice

  1. 1
    Step 1

    It defines the semantics/operations of the intermediate representation in a target-independent way.

  2. 2
    Step 2

    Front end produces IR; back end turns IR into target code.

  3. 3
    Step 3

    (iii) matches target-independence → front-end portability; (iv) doesn’t affect lexical/syntax analysis; (ii) is not a necessity; (i) is a method but not the key abstract-machine rationale.

  4. 4
    Step 4

    Choose the statement that most directly expresses the benefit of using an abstract machine for IR → (iii).

Key terms

  • Intermediate code
  • Abstract machine
  • Front end
  • Back end
  • Portability

Option relevance to the abstract machine model benefit

How well each statement matches the core reason for using an abstract machine for IR.

Why (i) isn’t the best answer (despite being true)

Knowledge Check

Question 1 of 3
Q1Single choice

In compiler design, generation of intermediate code based on an abstract machine model is useful because