Machine-translated by Google. Questions are authored in English.
Top

Discussion

If a compiler is to be retargeted to a new machine, the part most likely to require rewriting is

  • A.the parser
  • B.the preprocessor
  • C.the back end comprising code generation and machine dependent parts
  • D.the lexical analyser

Answer: C

Correct answer: the back end comprising code generation and machine dependent parts

The front end depends on the source language and the back end on the target machine, so changing the target leaves the front end untouched.

Instruction selection, register allocation, instruction scheduling and the machine-dependent optimisations all have to be rewritten. That separation is the whole argument for a common intermediate representation: front ends and back ends can be combined freely, so \( m \) languages and \( n \) machines need \( m+n \) components rather than \( m \times n \).

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.