CS 305 Compiler Design
CS 305 Compiler Design
Module-1
Q1. Define a translator and categorize it.
Q2. Explain briefly the challenges in designing a compiler.
Q5. Construct the two different parse trees for the expression
A/B*C
and also present the three address codes for both the cases.
Q6. Describe briefly how errors may be encountered by all the phases of a
Compiler and in these cases state function of an error handler.
Q20. Briefly discuss the different phases of a compiler. Define the term
Pass. How it differs from phase? Explain. Analysis and synthesis
phases.
Module II
Q35. For the same grammar defined in (14), show that the backtracking
parser can not accept these strings:
d + $, .-d+d$, .dd.$, -dd+$
S --> Aa|bAc|dc|bda
A -->d .
Show the grammar is LALR(1) but not SLR.
Q46. Consider the grammar
S --> Aa|bAc|Bc|bBa
A -->d
B -->d
Show the grammar is LR (1) but not LALR (1).
Module III
Q49. Writes SDTS for RE grammar to generate the NFA for corresponding RE.
Q50. Write SDTS to evaluate arithmetic expression?
Q51. What is Display? How does it help in accelerating program execution?
Q52. What is activation record? Explain the components of activation record.
Q53. For a language implementation in which activation record are created in stack, why it is not
recommended to have large arrays as local variables and parameters?
Q54. What is runtime storage allocation?
Q55. a) Give the parse tree and translation for the expression
(4*7+19)*2 according to the syntax-directed translation scheme.
b) Compare parse tree with syntax trees.
Q59. Using the translation scheme translate the following prog. Segment to
quadruples:
While A < C and B < D do
if A = 1 then C: = C + 1
else
while A <= D do A : = A + 2
Module V
*******