COMPILER DESIGN

CODE GENERATION

ROLE OF CODE GENERATION

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
Stage of compilation that removes redundant code and replaces inefficient code.
A
Lexical Analysis
B
Syntax Analysis
C
Semantic Analysis
D
Code Generation
E
Code Optimisation
Explanation: 

Detailed explanation-1: -The optimiser may identify redundant or repeated code, and remove or rearrange the code as necessary. This ensures the code runs as fast as possible.

Detailed explanation-2: -Code generation is the final stage of the compilation process. It takes the optimized intermediate code as input and maps it to the target machine language. Code generator translates the intermediate code into the machine code of the specified computer.

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: -PRE-PROCESSING. This is the very first stage through which a source code passes. COMPILING. After the compiler is done with the preprocessing stage. ASSEMBLY. At this stage the main. LINKING. This is the final stage at which all the linking of function calls with their definitions are done.

There is 1 question to complete.