Professional Documents
Culture Documents
1
IV B.Tech I Semester Supplimentary Examinations, February 2008
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]
4. (a) What is type expression? Write type expression for the following types. [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 inte-
gers 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) Which data structure will be used to implement a symbol table in an efficient
way? Give reasons. [8]
(b) Discuss and analyze about all the allocation strategies in run-time storage
environment . [8]
6. (a) What are the applications of DAG. Explain how the following expression can
be converted in a DAG
a+b*(a+b)+c+d [8]
(b) Explain how loop invariant components can be eliminated. [8]
1 of 2
Code No: RR411201 Set No. 1
(b) Explain the working of the above algorithm using a suitable example. [8]
8. Develop program specifications for the passes of a two pass assembler indicating
⋆⋆⋆⋆⋆
2 of 2
Code No: RR411201 Set No. 2
IV B.Tech I Semester Supplimentary Examinations, February 2008
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) Explain the reasons for separating lexial analysis phase from syntax analysis.
[6]
(b) Eliminate ambiguities from the following grammar
S → iEtSeS|iEtS|a
E → b|c|d [10]
4. (a) What is type expression? Write type expression for the following types. [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 inte-
gers 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 strat-
egy. [8]
(b) What are the advantages and disadvantages of heap storage allocation strat-
egy? [8]
6. (a) What are the applications of DAG. Explain how the following expression can
be converted in a DAG
a+b*(a+b)+c+d [8]
(b) Explain how loop invariant components can be eliminated. [8]
1 of 2
Code No: RR411201 Set No. 2
7. (a) Consider the following code sequence.
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]
⋆⋆⋆⋆⋆
2 of 2
Code No: RR411201 Set No. 3
IV B.Tech I Semester Supplimentary Examinations, February 2008
LANGUAGE PROCESSORS
(Information Technology)
Time: 3 hours Max Marks: 80
Answer any FIVE Questions
All Questions carry equal marks
⋆⋆⋆⋆⋆
1. Explain with one example how LEX program performs lexical analysis for the
following patterns in C : identifier, comments, numerical constants, arithmetic op-
erators.
[16]
2. (a) Eliminate ambiguity if any from the following grammar for boolean expres-
sions.
bexpr → bexpr or bterm|bterm
bterm → bterm and bfactor|bfactor
bfactor → nst factor|(bexpr)|true|false.
Where or, and, not (, ), true, false are terminals in the grammar. [8]
(b) Write a recursion discent parser for the above grammar. [8]
5. (a) Which data structure will be used to implement a symbol table in an efficient
way? Give reasons. [8]
(b) Discuss and analyze about all the allocation strategies in run-time storage
environment . [8]
1 of 2
Code No: RR411201 Set No. 3
(b) Explain in detail the optimization tecnique “Strength Reduction”. [7]
7. Generate code for the following statements for the target machine ( Target Machine
is a byte addressable machine with four bytes to a word and N general purpose
registers.) Assuming all variables are static. Assume 3 registers are available.
(a) x = a [I ] +1 [4]
(b) a[ I] = b [c[I ]] [4]
(c) a[I] [J] = b[I] [k] * c[k] [J] [4]
(d) a[I] = a[I] + b[J] [4]
(a) Show the contents of the symbol table at the end of the PASS I [5]
(b) Explain the significance of EQU and ORIGIN statements in the program. [6]
(c) Show the intermediate code generated for the given program. [5]
⋆⋆⋆⋆⋆
2 of 2
Code No: RR411201 Set No. 4
IV B.Tech I Semester Supplimentary Examinations, February 2008
LANGUAGE PROCESSORS
(Information Technology)
Time: 3 hours Max Marks: 80
Answer any FIVE Questions
All Questions carry equal marks
⋆⋆⋆⋆⋆
1. (a) Write regular expressions and NFA for the following patterns. Use auxiliary
definitions where convenient.
i. The set of words having a,e,i,o,u appearing in that order , although not
necessarily consecutively. [5]
ii. Comments as in C. [5]
(b) What is the difference between pass and a phase. [6]
2. (a) The grammar S → aSa|aa generates all even length string of a’s except for the
empty string. If a brute force method of top down parsor is used, it succeeds
of 2a’s, 4a’s, 8a’s but fails on 6a’s. Find out all even strings for which the
parser succeeds. [8]
(b) List out the rules for constructing the simple precedence table for a CFG. [8]
1 of 2
Code No: RR411201 Set No. 4
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 lan-
guage. [8]
6. (a) Explain with an example how abstract machine code can be generated for a
given if-then-else statement. [8]
(b) Write a short notes on peephole optimization. [8]
8. (a) Differentiate single pass and two pass translation of an assembler. [8]
(b) Explain Macro expansion ans Lexical expansion. [8]
⋆⋆⋆⋆⋆
2 of 2