B.TECH - Semester 6 complier design Question Paper 2013 (apr)
Practice authentic previous year university questions for better exam preparation.
Sample Questions
- What is the difference between compiler and interpreter?
- What is lexical analysis and what is its importance?
- How is top-down parsing different from bottom-up parsing?
- What is syntax directed transiation?
- What is an LR parser? ( $\mathbf{5} \boldsymbol{\times} \mathbf{4} \boldsymbol{=} \mathbf{2 0}$ Marks) (Answer one question completely from each module. Each carries 20 marks)
- (a) Explain the compilation process in detail. Explain all the stages with a suitable example.
- (b) With the help of an unambiguous grammar explain left-most derivation, right-most derivation and parse tree.
- Explain the following with examples: (a) bootstrapping in compilers.
- Explain the following with examples: (b) Cross-compilers
- Explain the following with examples: (c) Context free grammar
- Explain the following with examples: (d) BNF notation
- (a) Convert the NFA to DFA, where the set of states $Q=\{0,1,2,3\}$.
- (b) Draw a single DFA that recognises identifiers, relational operators and arithmetic operators.
- (c) What is meant by lex? Explain. OR
- (a) Construct a DFA for the regular expression $\mathrm{a}^{*} \mathrm{~b}^{*}(\mathrm{c} / \mathrm{b}) \mathrm{ab}$ *
- (b) What is meant by yacc? Explain.
- (c) Minimize the states of the given DFA. The resulting DFA should have transitions defined for all inputs for any state present in it. Module III
- (a) Construct a predictive parsing table for the following grammar. Modify the grammar if required. E → E \& T | T $T \rightarrow T^{*} F / F$ $\mathrm{F} \rightarrow(\mathrm{E}) \mid \mathrm{a}$
- (b) Explain with an examples of each what is $L L(1)$ grammar and non-LL(1) grammar. OR
- (a) Construct the FIRST and FOLLOW sets for the grammar given below: $E \rightarrow E+T \mid T$ $T \rightarrow T * F / F$ $\mathrm{F} \rightarrow$ (E) $\mid$ id
- (b) Explain what predictive, SLR and LALR parsers are. What are the conflicts possible in a shift reduce parsers?
- (a) Write the syntax directed translation for Boolean expressions and explain the translations with a sample Boolean expression statement.
- (b) Explain loop optimization techniques in detail with suitable examples
- (a) Write the equivalent three address code for the following code: for ( $\mathrm{i}=1 ; \mathrm{i}<=10 ; \mathrm{i}++$ ) \{ $y=x * 5$, \}
- (b) Write quadruple, triples and indirect triples for following expression: $(\mathrm{a}+\mathrm{b})^{*}(\mathrm{a}+\mathrm{b})+\left(\mathrm{a}^{*} \mathrm{c}\right)$ ( $4 \times 20=80$ Marks)