Download as pdf or txt
Download as pdf or txt
You are on page 1of 7

Code No: M1902/R05

Set No. 1

IV B.Tech I Semester Supplementary Examinations, March 2010 AUTOMATA AND COMPILER DESIGN (Electronics & Computer Engineering) Time: 3 hours Max Marks: 80 Answer any FIVE Questions All Questions carry equal marks

1. (a) Dene Alphabets, Strings, and Languages. Give two examples of each. (b) Consider the line number 4 of the following C program: int main() /* Line 1 */ { /* Line 2 */ int i, n; /* Line 3 */ fro(i=0, i<n, i++); /* Line 4 */ } /* Line 5 */ What is the compilers response about this line while creating the object module? Explain. [9+7] 2. (a) What is a recursive grammar? Explain. (b) Consider the following recursive grammar: i. S Aa |b ii. A Ac |Sd What is an equivalent grammar when the left recursion is removed? [6+10] 3. Construct the canonical collection of LR(1) items for the following grammar: E E + T |T T T F |F [16] F (E) |a. 4. Consider the expression: a := b *- c + b * - c Construct Postx Form, Abstract Syntax Tree, Quadruples and Triples. 5. (a) Explain in detail about overloading of functions and operators? (b) What is polymorphic function? Discuss in detail? [8+8] [16]

6. (a) What are self-organizing lists? How can this be used to organize a symbol table? Explain with an example? (b) Write about storage Organization? 7. Explain the machine independent Optimization in Detail? [10+6] [16]

8. Show DAG for the following statement. Z= X-Y+X*Y*U-V/W+X+V and nd the register requirement for its evaluation. Assume that all variables are of xed type and all operations require a single register. [16] 1 of 2 Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.

Code No: M1902/R05

Set No. 1

2 of 2 Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.

Code No: M1902/R05

Set No. 2

IV B.Tech I Semester Supplementary Examinations, March 2010 AUTOMATA AND COMPILER DESIGN (Electronics & Computer Engineering) Time: 3 hours Max Marks: 80 Answer any FIVE Questions All Questions carry equal marks

1. (a) Explain the major functions of Lexical Analyzer. (b) Show that the simplied regular expression recognized by the following DFA is the set of all strings of as and bs that end with letter as shown in gure 1b. [8+8]

Figure 1b 2. (a) Test whether the following grammar is LL(1) or not. S AaAb |BbBa A B (b) Construct the predictive parse table for the following grammar: SA A aB |Ad B bBC |f C g. 3. Consider the following grammar: E E E E + n |n (a) Construct the LR(0) parser. (b) Construct the SLR(1) parse table. (c) Find the moves made by the LR(0) parser on the input string: n + n + n. [5+5+6] 4. (a) Compare Inherited attributes and Synthesized attributes with an example. (b) Construct triples of an expression: a * - (b + c). [8+8]

[8+8]

5. Which of the following recursive type expressions are equivalent? Explain the reasons? 1 of 2 Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.

Code No: M1902/R05 e1 = integer e1 e2 = integer (integer e2) e3 = integer (integer e1).

Set No. 2
[16] [16]

6. Write and Explain about Runtime storage administration? 7. Explain the following (a) Copy Propagation (b) Dead-Code Elimination (c) Code Motion (d) Reduction in Strength. 8. (a) Explain the concept of calculating cost of instructions (b) Consider below addressing codes along with associated costs Mode Added Cost absolute 1 register 0 indexed 1 indirect register 0 indirect indexed 1 Compute cost of following set of statements i. mov b, R0 Add c , R0 Mov R0,a ii. add R2, R1 Mov R1,a iii. Mov b , a Add c , a.

[44]

[8+8]

2 of 2 Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.

Code No: M1902/R05

Set No. 3

IV B.Tech I Semester Supplementary Examinations, March 2010 AUTOMATA AND COMPILER DESIGN (Electronics & Computer Engineering) Time: 3 hours Max Marks: 80 Answer any FIVE Questions All Questions carry equal marks

1. (a) Design a DFA that accepts the language over the alphabet, = {0, 1, 2} where the decimal equivalent of the language is divisible by 3. (b) Compare compiler and an interpreter with the help of suitable examples. [8+8] 2. (a) What is the time complexity of a parser to parse a string of n tokens? (b) Consider the Grammar: G = ({S, A}, {a, b}, {S aAa |bAb| |A, A SS}, S) Find the leftmost derivation, rightmost derivation, and parse tree for the string: baabbb. [6+10] 3. Construct the SLR(1) parse table for the following grammar: S S S CC C cC |d.

[16]

4. (a) Construct an abstract syntax tree for the following C program fragment: if(10) while(20) if(0)break; else i = i + j; (b) What is meant by s-attributed grammar? Explain with an example. 5. Write and explain about equivalence of Type Expressions. [8+8] [16]

6. Write and Explain about algorithm for construction of equivalence trees in FORTRAN? [16] 7. Explain about: (a) a variable local to a procedure (b) a global variable (c) a formal parameter (d) a dynamically allocated global variable (e) a compiler generated temporary variable. 8. Explain briey about: (a) Register descriptor (b) Address descriptor (c) Function getreg. [5+5+6] [2+2+4+4+4]

1 of 1 Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.

Code No: M1902/R05

Set No. 4

IV B.Tech I Semester Supplementary Examinations, March 2010 AUTOMATA AND COMPILER DESIGN (Electronics & Computer Engineering) Time: 3 hours Max Marks: 80 Answer any FIVE Questions All Questions carry equal marks

1. (a) What is Finite Automaton? Give an example. (b) Find the number of tokens presented in the following FORTRAN statements: i. DO 100 I = 1.625 ii. IF ( MIN .EQ. MAX ) GOTO 1000 (c) Find the Regular Expression for the DFA as shown in gure 1c. [2+2+12]

Figure 1c 2. Construct a Context Free Grammar(CFG) that generates all even integers up to 998. [16] 3. Construct the DFA whose states are the canonical collection of LR(1) items for the following grammar: S AS |b A SA |a . [16] 4. (a) What is a Syntax Directed Denition? Give an example. (b) Explain the Dependency Graph with an example. 5. Explain the following: (a) Type System (b) Static and Dynamic Checking of types (c) Over loading of Operators & Functions. 6. (a) What are the contents of a symbol table? Explain in detail? (b) What is data structure used to implement a symbol table in an ecient way? Give reasons? [8+8] 7. What is ow-graph? Explain how given program can be converted into ow-graph? [16] 1 of 2 Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. [4+6+6] [6+10]

Code No: M1902/R05

Set No. 4
[16]

8. Write and explain an algorithm for building a DAG from a basic Block .

2 of 2 Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.

You might also like