• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests
October 31, 2022 |3.0K Views
Intermediate Code Generation in Compiler Design
  Share   Like
Description
Discussion

In this video, we will be discussing what is Intermediate Code Generation in Compiler Design. The procedure of translating any source code language into an internal form of code, before converting it completely to target code or machine code is called Intermediate code

This creation of Intermediate Code for any specific target machine is carried out by an intermediate code generator. Intermediate Code lies between high-level and machine-level language. 

Source Code → Intermediate Code → Target Code

If any compiler is directly translating source code to machine code without generating the intermediate code, then for every new system/machine, a completely new compiler would have been required. Intermediate code eliminates the requirement of any new compiler by keeping the analysis part (front end) the same for all compilers. The synthesis part of the compiler i.e. the backend is changed as per the target machine.

It is comparatively easy to modify source code for improving the performance of code by applying techniques of code optimization on intermediate code. Intermediate code is generally machine-independent. Because of this machine's independence, the portability of the code is enhanced. Retargeting has been facilitated. It’s now easier to modify source code for improving the source code’s performance by optimizing intermediate code.

Different types of Intermediate Code representations are:

  • Postfix notation
  • Three-address code 
  • Syntax Tree

Intermediate code generation in compiler design
https://www.geeksforgeeks.org/intermediate-code-generation-in-compiler-design/

Read More