Q8.Marks: +2.0UGC NET Paper 2: Computer Science 7th Dec 2023 Shift 2
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 ✓ Correct
4.improve the register allocation
Solution
The correct answer is increase the chances of reusing the machine independent code optimizer in other compilers
Key Points
The intermediate code is a lower level representation of the source code that can be used to bring some level of platform independence to the compilation process.
By defining an intermediate representation, we can design the first part of the compiler (called the front end), which translates high-level source code into intermediate code, to work with multiple languages.
The second part of the compiler (called the back end), which translates intermediate code into machine-specific code, can be made to work with multiple target architectures.
Therefore, the intermediate code can increase the chances of reusing the machine-independent code optimizer in other compilers, making the process more efficient.