MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

COMPILER DESIGN

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
Which is taken as input for the synthesis phase?
A
Source code
B
Object code
C
Intermediate code
D
Optimized code
Explanation: 

Detailed explanation-1: -Intermediate code generator receives input from its predecessor phase, semantic analyzer, in the form of an annotated syntax tree. That syntax tree then can be converted into a linear representation, e.g., postfix notation.

Detailed explanation-2: -Intermediate code generator receives input from its predecessor phase and semantic analyzer phase. It takes input in the form of an annotated syntax tree. Using the intermediate code, the second phase of the compiler synthesis phase is changed according to the target machine.

Detailed explanation-3: -The input to the code generator typically consists of a parse tree or an abstract syntax tree. The tree is converted into a linear sequence of instructions, usually in an intermediate language such as three-address code.

Detailed explanation-4: -The synthesis phase creates an equivalent target program from the intermediate representation. Symbol Table – It is a data structure being used and maintained by the compiler, consisting of all the identifier’s names along with their types. It helps the compiler to function smoothly by finding the identifiers quickly.

Detailed explanation-5: -Syntax trees can be used as an intermediate language. Postfix notations, three address codes (quadruples) can be used as an intermediate language.

There is 1 question to complete.