MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

COMPILER DESIGN

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
In this phase, it takes the optimized representation of the intermediate code and maps it to the target machine language.
A
Lexical Analyzer
B
Syntax Analyzer
C
Semantic Analyzer
D
Code Generator
Explanation: 

Detailed explanation-1: -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-2: -Code optimization is an optional phase. It is used to improve the intermediate code so that the output of the program could run faster and take less space. It removes the unnecessary lines of the code and arranges the sequence of statements in order to speed up the program execution.

Detailed explanation-3: -The code optimization in the synthesis phase is a program transformation technique, which tries to improve the intermediate code by making it consume fewer resources (i.e. CPU, Memory) so that faster-running machine code will result.

Detailed explanation-4: -Phase 1: Lexical Analysis. Phase 2: Syntax Analysis. Phase 3: Semantic Analysis. Phase 4: Intermediate Code Generation.

There is 1 question to complete.