Explain briefly about different phases involved in compiler, with a block diagram [6]
2.
Discuss the importance of error handler in compiler. How is it manipulated in the different phases of compilation? [6]
S2
1.
Given a regular expression $(\varepsilon + 0)^* 10$. Construct the DFA recognizing the pattern described by this regular expression using syntax tree based reduction. [6]
2.
What is shift reduce parsing techniques? Show shift reduce parsing action for the string (x+x)*a, given the grammar [6]
3.
Construct SLR parsing table for the following grammar.
$S \rightarrow aAa | bAb | ba$
[6]
4.
Define Syntax directed definition. Construct annotated parse tree for the input expression (5*3+2)*5 according to the following syntax directed definition.
$\[\begin{array}{|l|l|}\hline \text{Production} & \text{Semantic Rule} \\ \hline L \to E\text{n} & \text{Print } E.\text{val} \\ \hline E \to E_1 + T & E.\text{val} \to E_1.\text{val} + T.\text{val} \\ \hline E \to T & E.\text{val} \to T.\text{val} \\ \hline T \to T_1 * F & T.\text{val} \to T_1.\text{val} * F.\text{val} \\ \hline T \to F & T.\text{val} \to F.\text{val} \\ \hline F \to (E) & F.\text{val} \to (E.\text{val}) \\ \hline F \to \text{digit} & F.\text{val} \to \text{digit.lexval} \\ \hline \end{array}\]$
[6]
5.
Write Syntax Directed Definition to carry out type checking for the following expression.
$E \rightarrow id | E1 \text{ op } E2 | E1 \text{ relop } E2 | E1[E2] | E1↑$
[6]
S3
1.
Explain with example about different methods of intermediate code representation. [6]
2.
What is the purpose of code optimization? Explain different types of loop optimization techniques with example. [6]
3.
Discuss about the different factors affecting target code generation. [6]