edited
9,076 views
35 votes
35 votes

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

  1. make parsing and semantic analysis simpler.
  2. improve error recovery and error reporting.
  3. increase the chances of reusing the machine-independent code optimizer in other compilers.
  4. improve the register allocation.
edited

4 Answers

Best answer
38 votes
38 votes
C. that is the actual use of intermediate code generator in a compiler.
edited by
6 votes
6 votes
Intermediate code is machine independent code which makes it easy to retarget the compiler
to generate code for newer and different processors.
0 votes
0 votes

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

increase the chances of reusing the machine-independent code optimizer in other compilers.

Intermediate code provides an abstraction that is closer to the source language than the target machine language. It allows for a machine-independent representation of the program, making it easier to implement and reuse optimization techniques that are independent of the specific target architecture.

This facilitates the development of machine-independent optimization passes that can be shared among different compilers targeting various architectures. It promotes code optimization at a higher level of abstraction, reducing the need for target-specific optimizations in the early stages of the compilation process.

Answer:

Related questions

37 votes
37 votes
11 answers
2