Compiler Design

Compiler Design

Compiler Design
| Compiler Design |
Q.1
One of the purposes of using intermediate code in compilers is to
A. make parsing and semantic analysis simpler
B. improve error recovery and error reporting
C. increase the chances of reusing the machine-independent code optimizer in other compliers.
D. improve the register allocation.
Answer : Option C
Explaination / Solution:

Intermediate code is machine independent code which makes it easy to retarget the compiler to generate code for newer and different processors.

Workspace
Report
Q.2
In a compiler, keywords of a language are recognized during
A. parsing of the program
B. the code generation
C. the lexical analysis of the program
D. dataflow analysis
Answer : Option C
Explaination / Solution:

Any identifier is also a token so it is recognized in lexical Analysis

Workspace
Report
Q.3
 Consider the following intermediate program in three address code
p = a - b
q = p *c 
p = u * v 
q = p + q
Which one of the following corresponds to a static single assignment form of the above code ?
A.
B.
C.
D.
Answer : Option B
Explaination / Solution:
No Explaination.


Workspace
Report