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

Discussion

One of the purposes of using intermediate code in compilers is to

  • A.make parsing and semantic analysis simpler.
  • B.improve error recovery and error reporting.
  • C.increase the chances of reusing the machine-independent code optimizer in other compilers.
  • D.improve the register allocation.

Answer: C

One purpose is to increase the chances of reusing the machine-independent code optimizer in other compilers.

An intermediate representation separates the front end (source language) from the back end (target machine). Optimizations written on the intermediate code do not depend on either, so the same optimizer can be reused across compilers for different languages and machines.

Parsing and semantic analysis happen before intermediate code is produced, error reporting belongs to the front end, and register allocation is done for a specific machine in the back end, so the other options do not describe its purpose.

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

Post your comment

Please log in or register to post a comment.