B.TECH - Semester 6 complier design Question Paper 2020 (sep)
Practice authentic previous year university questions for better exam preparation.
Sample Questions
- State the differences between compiler and interpreter.
- Consider the grammar $\mathrm{S} \rightarrow(\mathrm{L}) / \mathrm{a}$ L → L, S /S Construct the leftmost derivation for the string (a, (a, a)).
- Define patterns, lexeme and tokens.
- Eliminate the left recursion in the grammar $S \rightarrow A a|b, A \rightarrow A c| S d \mid \in$
- Write a three address code for the expression $\mathrm{a}<\mathrm{b}$ or $\mathrm{c}<\mathrm{d}$.
- List out any four intermediate representations.
- What is an activation record? What information does it contain?
- What is copy propagation? Give example.
- Define the terms Handle and Pruning.
- What are the criteria for code-improving transformation? ( $\mathbf{1 0} \boldsymbol{\times} \mathbf{4} \boldsymbol{=} \mathbf{4 0}$ Marks) Answer any one full question out of two from each module.
- (a) Explain the various phases of the compiler in detail.
- (b) Discuss the issues in the design of a code generator.
- Construct a DFA for the given regular expression using subset construction method (a/b) *a(a/b) (a/b). Minimize the DFA.
- (a) Check whether the given grammar is LL (1) grammar or not. Give reason. $E \rightarrow E+T / T, T \rightarrow T^{*} F / F, F \rightarrow(E) / i d$.
- (b) Construct the non-recursive predictive parsing table for the following grammar. $$ \begin{aligned} & S \rightarrow i E t S S^{\prime} \mid a \\ & S^{\prime} \rightarrow e S \mid \in \\ & E \rightarrow b \end{aligned} $$
- Construct the SLR parsing table using $\mathrm{LR}(0)$ items and $\mathrm{LR}(0)$ automata for the following grammar $\mathrm{E} \rightarrow \mathrm{E}+\mathrm{T} \mid \mathrm{T}$ $\mathrm{T} \rightarrow \mathrm{T}^{*} \mathrm{~F} \mid \mathrm{F}$ $\...
- (a) Develop the syntax directed translation for the flow of control statement; $S->$ if $E$ then $S_{1}$ | if $E$ then $S_{1}$ else $S_{2}$ | while $E$ do $S_{1} \quad 6$
- (b) Explain the type checker with examples. 8
- (c) Translate the statements into three address code using back patching If $\mathrm{a}<\mathrm{b}$ and $\mathrm{a}<\mathrm{c}$ then $\mathrm{a}=\mathrm{b}+\mathrm{a} ;$ else $c=c+d$; OR
- (a) Is code optimization really optimizing the code? Justify your answer. Also explain the principal sources of optimization with an example.
- (b) Describe briefly about the storage organization and global data flow analysis. ( $\mathbf{3} \boldsymbol{\times} \mathbf{2 0} \boldsymbol{=} \mathbf{6 0}$ Marks)