• Intermediate Code Generation is a step in compiler design where the compiler converts high-level source code into an intermediate form that lies between the source code and the machine code.
  • The main purpose of this intermediate code is machine independence, which allows the same front-end of the compiler to be reused for different target machines.
  • The intermediate code is usually easier to manipulate and optimize compared to the high-level language, but still closer to human-readable code than machine code.
  • The typical or popular forms of intermediate code include syntax trees, three-address code (TAC),  quadruples, and Types & Declarations. 
    • Syntax Tree: A hierarchical tree representation of expressions, statements, and programs.
    • Three Address Code (TAC): It is the representation of instructions of the form x = y op z that uses at most three addresses (operands) structure.
    • Quadruples: Each TAC instruction is represented in the form of 4 (operator, arg1/op1, arg2/op2, result).
    • Types and Declarations: It includes information about variable types, sizes, and memory layout for efficient code generation.
  • After this phase of compiler design, code optimization and final machine code generation are easier.

Loading


0 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.