B.TECH - Semester 6 compiler design Question Paper 2019 (jun)
Practice authentic previous year university questions for better exam preparation.
Sample Questions
- Consider the following code. (j) $\quad i=i+1$
- Consider the following code. (k) ifi<=10 goto(2)
- Define the term Automata and the importance of using Regular Expression in designing the Compiler.
- Mention some of the cousins of the compiler.
- Illustrate the differences between DFA and NFA.
- List out the advantages of using Canonical LR parser than an SLR Parser.
- Left factor the grammar : $S \rightarrow i E t S|i E t S e S| a, E \rightarrow b$
- Write the three address code for the assignment $a=b^{\star}-c+b^{\star}-c$.
- List down the difficulties with top down parsing
- Define Peephole optimization.
- What is code motion? Apply the code motion transformation to the while loop : While(i<= limit-2) $\{i=i+1 ;\}$.
- How do we determine the leaders of the basic block? ( $\mathbf{1 0} \boldsymbol{\times} \mathbf{4} \boldsymbol{=} \mathbf{4 0}$ Marks) P.T.O. PART - B Answer any one full questions from each Module.
- (a) Explain various phases of a compiler and illustrate the representations of translating following statement: position : $=$ initial + rate * 60 .
- (b) List out some of the compiler construction tools.
- (a) Construct the minimal state deterministic finite automata for the regular expression (a/b)*ab*b.
- (b) Compare and contrast the buffering techniques. Also explain how does a scanner recover from lexical errors.
- (a) Construct the predictive parsing table for the following grammar. $$ \begin{aligned} & \mathrm{E} \rightarrow \mathrm{~T} \mathrm{E}^{\prime} \\ & \mathrm{E}^{\prime} \rightarrow+\mathrm{T} \mathrm{E}^{\prime} \mid \in \\ & \mathrm{T} \rightarro...
- (b) Design a context free grammar for the language that is the set of all strings of 0 s and 1 s with an equal number of 0 s and 1 s and give the left most derivation for the string 011010.
- Consider the grammar $\mathrm{S} \rightarrow \mathrm{C} \mathrm{C}, \mathrm{C} \rightarrow \mathrm{CC} \mid \mathrm{d}$. Construct a SLR-parsing table and parse tree by SLR parser on input dccd.
- Consider the following code. (a) $i=1$
- Consider the following code. (b) $j=1$
- Consider the following code. (c) $t 1=10^{*} i$
- Consider the following code. (d) $\mathrm{t} 2=\mathrm{tl}+\mathrm{j}$
- Consider the following code. (e) $\mathrm{t} 3=8^{*} \mathrm{t} 2$
- Consider the following code. (f) $\mathrm{t} 4=\mathrm{t} 3-88$
- Consider the following code. (g) $\mathrm{a}[\mathrm{t} 4]=0.0$
- Consider the following code. (h) $j=j+1$
- Consider the following code. (i) if $\mathrm{j}<=10$ goto (3)
- Consider the following code. (l) $\quad \mathrm{i}=1$
- Consider the following code. (m) $\quad \mathrm{t} 5=\mathrm{i}-1$
- Consider the following code. (n) t6=88*t5
- Consider the following code. (o) $a[t 6]=1.0$
- Consider the following code. (p) $\quad i=i+1$
- Consider the following code. (q) ifi<= 10 goto (13) Identify the basic blocks and construct the flow graph for above code and identify the loops in your flow graph. OR
- (a) Discuss run time storage management of a code generator.
- (b) Explain syntax - directed translation.