rr320504 Language Processors
rr320504 Language Processors
1
III B.Tech II Semester Supplimentary Examinations, Apr/May 2008
LANGUAGE PROCESSORS
(Computer Science & Engineering)
Time: 3 hours Max Marks: 80
Answer any FIVE Questions
All Questions carry equal marks
⋆⋆⋆⋆⋆
1. (a) Draw a block diagram of phases of a compiler and indicate the main functions
of each phase. [10]
(b) Write the main difference between compiler and interpreter. [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) Which of the following recursive type expressions are equivalent ? Justify your
answer?
e1 = integer → e1, e2 = integer →(integer → e2), e3 = integer →( integer →
e1). [8]
(b) Suppose that the type of each identifier is a sub range of integers for expressions
with the operators +, -,* , div and mod as in pascal. Write type? checking
rules that assign to each sub expression, the sub range its value must lie in.
[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 various machine dependent code optimization techniques. [8]
(b) Convert the following arithmetic expression into syntax tree and three address
code
b* 3 (a+b) [8]
7. (a) What is a flow graph. Explain how flow graph can be constructed for a given
program. [10]
1 of 2
Code No: RR320504 Set No. 1
(b) Compare the various forms of three address code. [6]
8. (a) Explain how lexical substitution is performed for model statements by a macro
preprocessor. [6]
(b) Differentiate Positional and keyword parameter. [5]
(c) How the value of the positional and keyword parameter is determined? Explain
with an example. [5]
⋆⋆⋆⋆⋆
2 of 2
Code No: RR320504 Set No. 2
III B.Tech II Semester Supplimentary Examinations, Apr/May 2008
LANGUAGE PROCESSORS
(Computer Science & Engineering)
Time: 3 hours Max Marks: 80
Answer any FIVE Questions
All Questions carry equal marks
⋆⋆⋆⋆⋆
1 of 2
Code No: RR320504 Set No. 2
(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]
⋆⋆⋆⋆⋆
2 of 2
Code No: RR320504 Set No. 3
III B.Tech II Semester Supplimentary Examinations, Apr/May 2008
LANGUAGE PROCESSORS
(Computer Science & Engineering)
Time: 3 hours Max Marks: 80
Answer any FIVE Questions
All Questions carry equal marks
⋆⋆⋆⋆⋆
1. (a) Draw a block diagram of phases of a compiler and indicate the main functions
of each phase. [10]
(b) Write the main difference between compiler and interpreter. [6]
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]
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. link
1 of 2
Code No: RR320504 Set No. 3
ii. pointer(cell)
iii. pointer(link)
iv. pointer(record((info X integer) X (next X pointer(cell))) [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) Explain with an example the abstract machine code form of Intermediate code.
[8]
(b) Give a detailed account on loop optimisation techniques. [8]
8. (a) Explain all the data structures used for designing the macro preprocessor. [8]
(b) Formulate an algorithm for processing Macro Definition. [8]
⋆⋆⋆⋆⋆
2 of 2
Code No: RR320504 Set No. 4
III B.Tech II Semester Supplimentary Examinations, Apr/May 2008
LANGUAGE PROCESSORS
(Computer Science & Engineering)
Time: 3 hours Max Marks: 80
Answer any FIVE Questions
All Questions carry equal marks
⋆⋆⋆⋆⋆
1. Explain with one example how LEX program perform lexical analysis for the fol-
lowing PASCAL patterns: identifier, comments, numerical constants, key words,
arithmetic operation. [16]
4. (a) Which of the following recursive type expressions are equivalent ? Justify your
answer?
e1 = integer → e1, e2 = integer →(integer → e2), e3 = integer →( integer →
e1). [8]
(b) Suppose that the type of each identifier is a sub range of integers for expressions
with the operators +, -,* , div and mod as in pascal. Write type? checking
rules that assign to each sub expression, the sub range its value must lie in.
[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]
8. Develop program specifications for the passes of a two pass assembler indicating
1 of 2
Code No: RR320504 Set No. 4
(a) Tables for internal use of the passes. [4]
(b) Tables to be shared between passes. [4]
(c) Inputs ( Files and Tables ) for every pass. [4]
(d) Outputs ( Files and Tables ) of every pass. [4]
⋆⋆⋆⋆⋆
2 of 2