Intermediate-code-generator

Question 1
 In the context of compilers, which of the following is/are NOT an intermediate representation of the source program?
A
Three address code
B
Abstract Syntax Tree (AST)
C
Symbol table
D
Control Flow Graph (CFG)
Question 1 Explanation: 
  • An intermediate representation is a representation of a program “between” the source and target languages. A good IR is one that is fairly independent of the source and target languages, so that it maximizes its ability to be used in a retargetable compiler.

    Types of intermediate representation:

    1. Structured (Tree such as abstract syntax tree or Graph such as CFG, single static assignment)
    2.  tuple-based, generally three-address code (quadruples)

     

    Symbol table is not an intermediate representation of a source program. Symbol table is created in the first phase (lexical analysis phase and subsequently updated in later phases) and it stores the information about the occurrence of various entities such as variable names, function names, objects, classes, interfaces, etc.

     

    Abstract syntax tree and three address code are well known representations of intermediate code.

    CFG i.e., control flow graph is also a representation of intermediate code which represents the flow of control of the program. In CFG we break sequences of three address codes into basic blocks hence CFG is also a representation of intermediate code as it contains three address codes along with control flow representation with help of blocks and edges (arrows).

There is 1 question to complete.

Access quiz wise question and answers by becoming as a solutions adda PRO SUBSCRIBER with Ad-Free content

Register Now

If you have registered and made your payment please contact solutionsadda.in@gmail.com to get access