Sei sulla pagina 1di 4

Code: R7411904

IV B.Tech I Semester (R07) Regular & Supplementary Examinations, November/December 2011 AUTOMATA & COMPILER DESIGN (Electronics & Computer Engineering) Time: 3 hours Answer any FIVE questions All questions carry equal marks ***** (a) Define NFA and DFA. Convert the following NFA into equivalent DFA. 0,1 1 0 Max Marks: 80

Check the acceptance of the string 1011 on both the machines. (b) Explain about any one lexical analyzer generator tool. 2 Write procedures for calculating FIRST and FOLLOW sets for a given grammar symbols, constructing predictive parsing table and parsing acting for a given string. Constraint predictive parsing table for the following grammar. E TE1 E1 +T E1 / 1 T FT T1 * FT1/ F (E)/id Show the moves made by the parser for the string id*id+id. Construct SLR parsing table for the following grammar. E E+T/T T T*F/F F (E)/id Show the moves of the parser for the string id*id+id. (a) Define SDT. Define a SDD for constructing syntax trees for the expressions generated by following grammar. E E+T/E-T/T T (E)/id/num Draw the annotated parse tree for a-4+c. (b) Explain in detail about three address code representations. (a) Explain about type checking for overloaded functions and operators. (b) Explain about the chemistry hierarchy of languages in detail. Discuss in detail about static, stack and heap storage allocation strategies. (a) Discuss about peep hole optimization. (b) Write about global data flow analysis. (a) Write about the issues in code generation. (b) Discuss in detail about register allocation and assignment. *****

6 7

2
Code: R7411904 IV B.Tech I Semester (R07) Regular & Supplementary Examinations, November/December 2011 AUTOMATA & COMPILER DESIGN (Electronics & Computer Engineering) Max Marks: 80 Answer any FIVE questions All questions carry equal marks ***** 1 (a) Explain about the use of finite automata in lexical analysis. (b) Draw an NFA for recognizing the string generated by (0+1)*(10+01). Convert it into equivalent DFA. 2 Design a CFG for following languages. Show the left most and right most derivations for given strings. i) Language of non-palindromes over {a,b}. string: abbaa. ii) Language of strings over {0,1} containing equal number of os and 1s string: 011001 Time: 3 hours

3 (a) Write rules for computing FIRST and FOLLOW sets for grammar symbols of a given grammar. Compute FIRST and FOLLOW sets of grammar symbols of following grammar. S AB A a B C BA (b) How do you check whether a given grammar is LL(1) or not without constructing the predictive parsing table. Check whether the following grammar is LL(1) or not using your method .(without constructing the parsing table). S iE SS1/a S1 eS/ E b 4 (a) Discuss about s-attributed grammar with suitable example. (b) Write three address code for the following c-source code segment. i=a+b; for(;i<=100; i++) X[i]=i*10; 5 (a) What is a type checker? Design a type checker for expressions generated by a simple expression grammar. (b) Explain about the chemistry hierarchy of languages. 6 Discuss in detail about different types of storage allocation strategies.

7 (a) Explain about principle sources of optimization. (b) Write about data-flow analysis of flow graphs. 8 Write short notes on a) Generic code generation. b) DAG.

*****

Code: R7411904

IV B.Tech I Semester (R07) Regular & Supplementary Examinations, November/December 2011 AUTOMATA & COMPILER DESIGN (Electronics & Computer Engineering) Time: 3 hours Answer any FIVE questions All questions carry equal marks ***** 1 (a) Write about the use of regular expressions and FAs in lexical analysis. (b) Discuss about the specification of a LEX program (source code). 2 (a) What is an ambiguous CFG? Give an example. Eliminate ambiguity from the following grammar. E E+E/E*E/(E)/id (b) Construct predictive parsing talde for the following grammar. bexpr bexpr or bterm/bterm bterm bterm and bfactor/bfactor bfactor not bfactor/(bexpr)/true/false Note:-or, and, not, (,), true and false are terminals. 3 Explain in detail about the parser generator YACC. Max Marks: 80

4 (a) Explain about various forms of intermediate code with an example for each. (b) With suitable examples, explain about synthesized attributes and inherited attributes. 5 (a) Explain about equivalence of type expressions. (b) Explain about type checking for overloaded function and operators. 6 (a) Discuss in detail about the language facilities for dynamic storage allocation. (b) Write about storage allocation scheme for accessing global variable and local variables. 7 (a) Discuss about optimization of basic blocks. (b) Explain about the global data flow analysis of flow graphs. 8 Write short notes on the following: a) Register allocation and assignment. b) Machine dependent code optimization. *****

Code: R7411904

IV B.Tech I Semester (R07) Regular & Supplementary Examinations, November/December 2011 AUTOMATA & COMPILER DESIGN (Electronics & Computer Engineering) Time: 3 hours Answer any FIVE questions All questions carry equal marks ***** 1 (a) Define DFA and NFA. Convert the following NFA into equivalent DFA. 1 0,1 0,1 Max Marks: 80

0,1 Check the acceptance of the string 00100 on both. (b) Explain the use of regular expressions in lexical analysis. 2 Write the rules (methods) for compution FIRST and FOLLOW sets, construction of predictive parsing table and parsing method (algorithm) of a string using predictive parsing table. Construct predictive parsing table for the following grammar and show the moves of the parser for the string a+a*a. E TE1 T FT1 F (E)/a E1 +TE1 T1

*FT1/

3 (a) Explain the general method of bottom up parsing with an example. (b) Discuss about the typical format of a YACC program specification. 4 (a) Develop a SDD or SDT for generating three address code for the control flow statements ifelse and switch statements in C. (b) Write short notes s-attributed grammars. 5 (a) Explain about equivalence of type expressions. (b) Explain the Chomsky hierarchy of languages. 6 Write short notes on following: a) Stack allocation strategy for storage. b) Language facilities for dynamic storage allocation.

7 (a) What are the principle sources of optimization? Explain with suitable examples. (b) Explain about peep hole optimization. 8 Write short notes on a) Object code forms b) Use of DAG in code generation. c) Generic code generation (algorithm). *****

Potrebbero piacerti anche