CD PreFinal Question Paper
CD PreFinal Question Paper
b) List the various error recovery strategies for a lexical analysis. [3]
j) List out the common issues in the design of code generator. [3]
4.a) Check whether the following grammar is SLR (1) or not. Explain your answer with
Reasons. S→ L=R S→R L→*R L→id R→L.
b)What is an LR(0) grammar?. Construct LALR parsing table for the following grammar: S→
CC, C → cC , C → c|d . [5+5]
OR
5.a) Consider the grammar. E → E + T
E→T
T→T*F
T→F
F → (E) / id
Construct CLR parsing table for the above grammar. Give the moves of the CLR parser on id *
id + id.
b) What is an LR(0) item? Construct an SLR parsing table for the grammar G: S→ L=R |R, L →
*R | id, R → L. Is it SLR(1) grammar? [5+5]
6.a) What is a three address code? . Consider the following basic block of 3-address
instructions: a:=b+c x:=a+b b:=a-d c:=b+c d=a-d y=a-d
b) Generate the three address code for the following code fragment.
a = b + 1 x = y + 3 y = a / b a = b + c [5+5]
OR
7.a) What are different intermediate code forms? [5+5]
b)Discuss different Three Address code types and implementations of Three Address
statements.
---ooOoo---