Code No: RR411201

Set No. 1

IV B.Tech I Semester Supplementary Examinations, February 2007 LANGUAGE PROCESSORS (Information Technology) Time: 3 hours Max Marks: 80 Answer any FIVE Questions All Questions carry equal marks ⋆⋆⋆⋆⋆ 1. (a) Write a procedure for constructing a deterministic finite automata from a non-deterministic Automata, explain with one example. [10] (b) Give the general format of a LEX program. 2. (a) Distinguish operator precedence and simple precedence parses. (b) Generate operator precedence parse table for the following grammar. E → E + T|T T → TF|F F → F∗ |a|b [10] 3. (a) What is LR(1) passing. (b) Construct canonical LR parse table for the following grammar S → Aa|bAc|bBa A→d B→d. 4. Write type expression for the following types (a) An array of pointers to real, where the array index ranges from 1 to 100. (b) A two dimensional array of integers ( i.e an array of arrays) whose rows are indexed from 0 to 9 and whose columns are indexed from 10 to 10. [5] [6] [6]

[4+12]

[5]

(c) Functions whose domains are functions from integers to pointers to integers and whose ranges are records consisting of an integer and a character. [6] 5. (a) What are the contents of a symbol table? Explain in detail. [8]

(b) What is the data structure used to implement a symbol table in an efficient way? Give reasons ? [8] 6. (a) Explain with an example the abstract machine code form of Intermediate code. [8] (b) Give a detailed account on loop optimisation techniques. [8]

7. (a) Explain how Redundant sub expression elimination can be done at global level in a given program. [8] 1 of 2

Code No: RR411201

Set No. 1

(b) Explain how syntax trees can be constructed for the following expression a*b-(c+d) a*b+(a*b) [8] 8. Design the algorithm for the PASS II of an assembler. Explain the Data structure used in PASS II [16] ⋆⋆⋆⋆⋆

2 of 2

Code No: RR411201

Set No. 2

IV B.Tech I Semester Supplementary Examinations, February 2007 LANGUAGE PROCESSORS (Information Technology) Time: 3 hours Max Marks: 80 Answer any FIVE Questions All Questions carry equal marks ⋆⋆⋆⋆⋆ 1. (a) Write a procedure that combines two NFAs in to a single NFA. The operations to be performed are those of concatenation, union and closure. [10] (b) Write a procedure that detects all extraneous states in a DFA. [6] 2. (a) Convert the following grammar into LL(1) grammar R → R“|′ R|RR|R ∗ |(R)|a|b [10] (b) What are the advantages and disadvantages of operator precedence parsing. [6] 3. (a) What is an LR(0) grammer. (b) Construct SLR passing table for the following grammer R → R‘1′ R|RR|R ∗ |(R)|a|b 4. (a) Write a note on the specification of a Simple type checker. (b) Explain the equivalence of type expressions with appropriate examples. [4] [12] [8] [8]

5. (a) What are self-organizing lists. How this can be used to organize a symbol table. Explain with an example. [8] (b) Explain the process of organizing a symbol table for a block structured language. [8] 6. (a) Translate the expression -(a+b)*(c+d)+(a+b+c) into quadruple, triple and indirect triple. [9] (b) Explain in detail the optimization tecnique “Strength Reduction”. [7] 7. (a) Define Address Descriptor and Register Descriptor. (b) Why Next-use information is required for generating Object code? (c) What are the various object code forms. [4] [6] [6]

8. (a) Define the following i. Macro [2] ii. Macro expansion [2] iii. Lexical Expansion [2] iv. Semantic Expansion [2] (b) What is meant by Macro definition? Explain the data structures used in a Macro Processor. [8] ⋆⋆⋆⋆⋆ 1 of 1

Code No: RR411201

Set No. 3

IV B.Tech I Semester Supplementary Examinations, February 2007 LANGUAGE PROCESSORS (Information Technology) Time: 3 hours Max Marks: 80 Answer any FIVE Questions All Questions carry equal marks ⋆⋆⋆⋆⋆ 1. (a) Write about lexical analyzer generator. (b) Construct minimumstate DFAs for the following regular expressions. i. (a+b)* a (a+b) ii. (a+b)* a (a+b) (a+b) iii. (a/b)* a (a/b)(a/b)(a/b). 2. (a) Convert the following grammar into LL(1) grammar R → R“|′ R|RR|R ∗ |(R)|a|b [3] [3] [3] [10] [7]

(b) What are the advantages and disadvantages of operator precedence parsing. [6] 3. (a) What is an LR(0) grammer. (b) Construct SLR passing table for the following grammer R → R‘1′ R|RR|R ∗ |(R)|a|b 4. (a) What is type expression? Write type expression for the following types. [4] [12] [2]

i. A two dimensional array of integers (i.e. an array of arrays) whose rows are indexed from 0 to 9 and whose columns are indexed from -10 to 10. [3] ii. Functions whose domains are functions from integers to pointers to integers and whose ranges are records consisting of an integer and a character. [3] (b) What is type system. Discuss static and dynamic checking of types. [8] 5. (a) What are the advantages and disadvantages of static storage allocation strategy. [8] (b) What are the advantages and disadvantages of heap storage allocation strategy? [8] 6. (a) Translate the expression -(a+b)*(c+d)+(a+b+c) into quadruple, triple and indirect triple. [9] (b) Explain in detail the optimization tecnique “Strength Reduction”. 7. (a) Consider the following code sequence. 1 of 2 [7]

Code No: RR411201

Set No. 3

i. MOV B, R0 ADD C, R0 MOV R0 A ii. MOV B,A ADD C, A Calculate the cost of the above instructions in terms of access time and memory usage. [10] (b) Explain the simple Strategy to generate assembly code from Quadruples. [6] 8. (a) List out the data structure to perform Macro Expansion. (b) Write an algorithm for Macro processing. ⋆⋆⋆⋆⋆ [8] [8]

2 of 2

Code No: RR411201

Set No. 4

IV B.Tech I Semester Supplementary Examinations, February 2007 LANGUAGE PROCESSORS (Information Technology) Time: 3 hours Max Marks: 80 Answer any FIVE Questions All Questions carry equal marks ⋆⋆⋆⋆⋆ 1. (a) Write about transition diagrams and construct transition diagram for the relational operators. [8] (b) Write a specification for the tokens identifiers, constants and comments of pascal From this specification, construct equivalent transition diagrams. Use the transition diagram to implement a lexical analyzer for pascal in ‘C’. [8] 2. (a) Define LL(1) grammar. (b) Construct LL(1) parse table for the following grammer. bexpr → bexpr or bterm/bterm bterm → bterm and bfactor|bfactor bfactor → not factor|(blxpr)|true|false Where or, and, not, (, ), true, false are terminals in the grammar. [4]

[12]

3. Explain the algorithm for translator of S-attributed grammars along with bottom up parsing with suitable examples. [16] 4. (a) How do you check the expressions in polymorphic functions? Explain through an example. [8] (b) Consider the following declarations type link = ↑ cell; var next : link; last : link; p : ↑ cell; q,r : ↑ cell; Which among the following expressions are Structurally equivalent? Which are name equivalent? Justify your answer. i. ii. iii. iv. link pointer(cell) pointer(link) pointer(record((info X integer) X (next X pointer(cell)))

[8]

5. (a) What are the advantages and disadvantages of static storage allocation strategy. [8] (b) What are the advantages and disadvantages of heap storage allocation strategy? [8]

1 of 2

Code No: RR411201

Set No. 4
[8] [8] [8]

6. (a) Explain any two machine dependent code optimization techniques. (b) What is a DAG. Explain its application. 7. (a) Discuss the various forms of object code.

(b) Explain how the nature of the object code is highly dependent on the machine and the operating system. [8] 8. Formulate an algorithm for the First pas of the assembler. Explain the Data structure used during the PASS I of an assembler. [16] ⋆⋆⋆⋆⋆

2 of 2