You are on page 1of 4

Code: 9A12501

1
(Common to CSS and IT)

B.Tech III Year I Semester (R09) Regular & Supplementary Examinations December/January 2013/14 AUTOMATA AND COMPILER DESIGN Time: 3 hours Answer any FIVE questions All questions carry equal marks ***** 1 (a) (b) 2 Construct NFA for (a + b)*abb (a + b)*. Process the string ababbab. Construct a minimum state DFA for (a + b)*ab. Construct predictive parse table for the following grammar. Show the moves of the parser for the string id = *id. S L=R / R L *R / id RL Construct SLR parsing table for the following grammar. E E or T / T T T and F / F F not F / (E) / true / false Write S-attributed definition for generating the decimal value of the binary number generated by the following grammar. S L.L / L L LB / B B 0/1 Draw the annotated parse tree for 101.11 Generate three address code and quadruples for the following expression. a = (a+b) + b * (d + e) Write and explain about equivalence of type expressions. Write detailed notes on the symbol table mechanism using tree data structure. Write detailed notes on the symbol table mechanism using hash table structure. Write and explain about data-flow analysis of structured programs. Write about conservative estimation of data-flow information. Explain the role of addressing modes in code generation. Max Marks: 70

4 (a)

(b)

5 6 (a) (b) 7 (a) (b) 8

*****

Code: 9A12501

2
(Common to CSS and IT)

B.Tech III Year I Semester (R09) Regular & Supplementary Examinations December/January 2013/14 AUTOMATA AND COMPILER DESIGN Time: 3 hours Answer any FIVE questions All questions carry equal marks ***** 1 (a) (b) 2 What is lexical analysis? What is its role in compiler design? Explain with examples. Design a DFA for recognizing the language generated by a(a + b)* ab. Eliminate left recursion from the following grammar and construct predictive parse table for the resulting grammar. S a / ^ / (T) T T,S / S Show the moves of the parser for (a, a) Write in detail about YACC. What is handle? Explain about handle pruning with an example. Write three address code for the following C-program segment. for ( i=1; i <=m; i++) for (j=1; j<=n;j++) { c[i,j] = 0; for (k=1; k<=p; k++) c[i,j] = c[i,j] + a[i,k] * b[k,j]; } What is importance of polymorphic functions? Write translation scheme for checking polymorphic functions. Explain in detail the various storage allocation strategies. What is flow-graph? Explain how given program can be converted into flow-graph. Show DAG for the following statement. Z = X-Y+X*Y*U-V/W+X+V and find the register requirement for its evaluation. Assume that all variables are of fixed type and all operations require a single register. Max Marks: 70

3 (a) (b) 4

5 (a) (b) 6 7 8

*****

Code: 9A12501

3
(Common to CSS and IT)

B.Tech III Year I Semester (R09) Regular & Supplementary Examinations December/January 2013/14 AUTOMATA AND COMPILER DESIGN Time: 3 hours Answer any FIVE questions All questions carry equal marks ***** 1 (a) (b) What is lexical analysis? What is its role and importance in compiler design? Convert the following NFA to DFA. 0, 1
q0

Max Marks: 70

q1

0, 1

q2

2 (a) (b)

Write in detail about error recovery in predictive parsers. Construct CFG for the following languages. (i) Strings over {0, 1} ending with 10 (ii) Palindromes over {a, b} (iii) L = { aibjck / j > i + k and i, j, k >= 0} Construct LALR parsing table for the following grammar. Show the actions of the parser for the string (a, a). S a / ^ / (R) RT T S,T / S Write short notes on: Quadruples and triples. Importance of intermediate code generation. L attributed and S attributed definitions. Write a short notes on context sensitive language with suitable example. Write about linear bounded automata. Explain the following: Organization of C activation record. Procedure calls in C. Convert the following arithmetic expression into syntax tree and three address code b*3(a+b). What are loop invariant components? Explain how they affect the efficiency of program. Generate optimal code for following assignment statements: x=a+b+c x = ( a * -b ) + ( c ( d + e ) ) x = ( a / b c) / d x = a + ( b + c / d * e ) / ( f * g = h * i)

4 (a) (b) (c) 5 (a) (b) 6 (a) (b) 7 (a) (b) 8

*****

Code: 9A12501

4
(Common to CSS and IT)

B.Tech III Year I Semester (R09) Regular & Supplementary Examinations December/January 2013/14 AUTOMATA AND COMPILER DESIGN Time: 3 hours Answer any FIVE questions All questions carry equal marks ***** 1 (a) (b) 2 Draw transition diagram of NFA for recognizing the language generated by (11+10)*10. Convert it into DFA. Explain how FAs are useful in recognizing tokens. Eliminate left recursion from the following grammar and then write recursive predictive parser routines. E E+T / T T T*F / F F (E) / a Give the parser steps for the string a+a*a. Write short notes on: Using ambiguous grammars in YACC. General method of shift reduces parsing. Handles and handle pruning. Translate the following code fragment into three address code and quadruples. while ( a<c and b<d) { if a= =1 then c = c + 1; else while (a<=d) a = a+1; } Explain the concept of type graph in view of cycles existing in that graph. What are coercions? What are self-organizing lists? How can this be used to organize a symbol table? Explain with an example. Write about storage organization. Write and about global common sub expression elimination. Explain about generic code generation algorithm. Max Marks: 70

3 (a) (b) (c) 4

5 (a) (b) 6 (a) (b) 7 8

*****

You might also like