Академический Документы
Профессиональный Документы
Культура Документы
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.
Module-II
1. Consider two or three high-level prog. lang. with which you are
familiar and discuss their features that you think are most valuable to
a programmer.
2. Discuss briefly the different phases of a compiler. Define the term
Pass. How it differs from phase? Explain. Analysis and synthesis
phases.
Show informally that the strings: aabc,abbc,abcc are not derivable from
the grammer.
Q25. Design a CFG that generates all non empty strings of 0's and 1's s.t.
the first of the string is identical to the 2nd half.
Q26. Design a CFG that generate palindrome of 0's and 1's.
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.
S --> Aa|bAc|Bc|bBa
A -->d
B -->d
Show the grammar is LR (1) but not LALR (1).
Module V and VI
Q49. Writs 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.
Q58. Write quadruples, triples and indirect triples for the expression
-(a+b)*(c+d)-(a+b+c).
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 VII
Q60. Discuss factor effecting target code generation.
Q61. Consider the following statements
X=a/(b+c)-d *(e+f)
Assume two registers are available. Perform code generation using tree and dynamic programming.
Q62. Consider the following statements
X=a/(b+c)-d *(e+f)
Perform register allocation assuming (i) one (ii) two (iii) three registers available.
*******