SPCC PYQs
SPCC PYQs
Also state that whether the given grammar is LL(1) or not. [10M]
Q3) Explain the different phases of a compiler with suitable example. [10M] (x2)
Q4) Compute FIRST and FOLLOW for the following grammar. [5M]
Q5) Construct LR(0) parsing table for the following grammar and analyze the contents of
stack and input buffer and action taken after each step while parsing the input string
“abbcbcde”. [10M]
Q6) What are the phases of compiler? Give working of each phase for the following
statement: [10M]
P=Q+R–S*3
Also state that whether the given grammar is LL(1) or not. [10M]
Q9) Construct SLR parser for the following grammar and parse the input “()()”: [10M]
Q12) Explain the phases of a compiler. Discuss the action taken in various phases to compile
the statement:
a=b*c+10, where a, b, c are of type real. [10M]
Q10) Explain the concept of basic blocks and flow graph with example of three address code.
[10M]
Q11) What is code optimization? Explain with example, the following code optimization
techniques: [10M]
(i) Common sub-expression elimination
(ii) Code Motion
(iii) Dead code elimination
(iv) Constant propagation