You are on page 1of 5

NARAYANA ENGINEERING COLLEGE :: GUDUR

(Recognized by UGC 2(f) & 12(B), An ISO 9001:2015 Certified Institution, Approved by AICTE New Delhi & Permanently Affiliated to JNTUA Anantapuranu)

COMPILER DESIGN (15A05601)


10 Marks Question Bank
Class: III B.Tech II Sem Academic Year: 2019-20
Branch: CSE Staff : C. Rama Mohan

UNIT-I

S. No. Question CO BL Marks

1 Explain in detail about the phases of a compiler. (Reg- 2019) 1 2 10

Explain the following:


5
2 a) The lexical analyzer generator Lex. 1 2
5
b) Recognition of tokens. (Reg- 2019)

a) Show intermediate representation and symbol table entries of the following


5
3 code segment compilation int x, y, z = x + y* 5. 1 2
5
b) Write a LEX program for a simple programming language. (Supply- 2018)

a) Explain about input buffering. 5


4 1 2
b) Construct DFA for a pattern recognition of (a/b)* abb. (Supply- 2018) 5

a) Show the sequence output of each phase of a compiler for the following code
5
5 segment: int x = 5, y = 10,z; z = x+ y*5; printf(“%d”, z); 5. 1 2
5
b) Write a LEX program for a C programming language. (Reg- 2018)

(a)Explain about state minimization of finite automata. 5


6 1 2
(b)Construct NFA and find DFA for a pattern recognition of (a/b)*abb. (Reg- 2018) 5

7 How do you specify the tokens? Explain with proper examples 1 2 10

8 Explain about Input buffering scheme for scanning the source program 1 2 10

a) What is the role of lexical analyzer? 5


9 1 2
b) Explain format for the input or source file of LEX 5

a) Differentiate between Compiler vs Interpreter. 5


10 1 2
b) Differentiate between Phase vs Pass 5
UNIT-II

S. No. Question CO BL Marks

Construct SLR parsing table for the following grammar:


1 E → E + T/T T → T * F/F F → (E)/a 2 3 10
Show the moves of the parser for parsing the string a * a + a. (Reg- 2019)

2 Describe the steps for LALR parser. (Reg- 2019) 2 2 10

Construct LR parsing for the following grammar: (Supply- 2018)


3 S → (T)|a 2 3 10
T → T, s|s.
a) What is unambiguous grammar? Give an example for ambiguous grammar.
5
4 b) Write a code for a parser generator of an assignment and if-then-else 2 2
5
statements. (Reg & Supply- 2018)
Construct CLR parsing for the following grammar:
5 S→ CC 2 3 10
C→ cC/d (Reg- 2018)

6 Explain about Context Free Grammar with an example. 2 2 10

Construct SLR parsing table and transition diagram for the given grammar below:
E→ E+T
E→ T
7 T→ T*F 2 3 10
T→ F
F→ (E)
F→ id
Construct LALR parsing table for the given grammar below:
S→L=R
S→R
8 2 3 10
L→*R
L→ID
R→L
a) Construct SLR (or) LR(0) items and parsing table for the given Ambiguous
grammar below: 5
9 2 3
E→ E+E| E*E| (E)| id 5
b) Explain about Dangling-else ambiguity.
What is meant by Ambiguity? How do you eliminate the ambiguity in the grammar 5
10 2 2
using both left recursive and left factoring methods? Explain with examples. 5
UNIT-III

S. No. Question CO BL Marks

Explain in detail about the implementation of L-attributed SDD’s with an example.


1 3 2 10
(Reg- 2019)

a) With the help of SDDs, discuss the generation of three address code for if-else
statements. 5
2 3 2
b) What do you mean by type checking? Discuss the method used for type 5
checking in a compiler. (Reg- 2019)

a) What is meant by back patching? Show back patching a Boolean expression? 5


3 3 2
b) Discuss the various types of three address code in detail. (Supply- 2018) 5

Write SDT to generate intermediate code for arithmetic expression. Give an


4 3 2 10
example. (Supply- 2018)
a) What is meant by back patching? Show back patching in a Boolean expression.
5
5 b) Discuss various types of three address code representation for the following 3 2
5
code segments: x = x+y*10; z = x; (Reg- 2018)
Write SDT to generate intermediate code for assignment statement. Give an
6 3 2 10
example. (Reg- 2018)

7 Define S-attributed and L- attributed grammars 3 2 10

a) What is meant by 3-address code? Give some examples of 3-address


5
8 statements. 3 2
5
b) How do you translate Syntax directed translation into 3-address code?

9 Discuss briefly about Syntax directed definitions with an example 3 2 10

10 Explain about Construction of Syntax trees and DAGs for expressions 3 2 10


UNIT-IV

S. No. Question CO BL Marks

a) Explain stack allocation of space in runtime environment of a compiler. 5


1 4 2
b) Explain heap management mechanism. (Reg- 2019) 5

2 Describe about the access of non-local names in stack storage. (Reg- 2019) 4 2 10

a) Describe about symbol table organization for non block structured language. 5
3 b) Explain how to allocate stack space for function call statement execution. 4 2
5
(Supply- 2018)

a) Describe about various representations of symbol table. 5


4 b) Write short note on heap memory management during program execution. 4 2
5
(Supply- 2018)

a) Describe about symbol table organization for block structured language. 5


5 b) Explain how to allocate heap memory space for dynamic memory allocation. 4 2
5
(Reg- 2018)

a) Describe about various representations of symbol table. 5


6 b) What is activation record? Explain the structure of an activation record. (Reg- 4 2
5
2018)

Explain about all the Storage allocation strategies in run time storage
7 4 2 10
environment

What is an Ordered and Unordered symbol table? Which data structures are
8 4 2 10
used to implement a symbol table in an efficient way? Give reasons.

9 Distinguish between static and Dynamic storage allocation techniques 4 2 10

10 Explain the construction of Activation tree 4 2 10


UNIT-V

S. No. Question CO BL Marks

1 Explain about various issues in code generator. (Reg- 2019) 5 2 10

Explain about the directed acyclic graph representation of basic blocks and its use
2 5 2 10
with suitable examples. (Reg- 2019)

a) Write algorithm for generating basic block and flow graph. 5


3 5 2
b) Describe about optimization in a basic flow graph. (Supply- 2018) 5

Describe about various loop optimization techniques with an example.


4 (Supply- 2018)
5 2 10

a) What is direct acyclic graph? Explain how this is useful for dataflow analysis.
5
5 b) Describe the following: 5 2
5
(i) Common sub expression. (ii) Induction variable elimination. (Reg- 2018)

6 Describe about various peephole techniques with examples. (Reg- 2018) 5 2 10

Explain different principle sources of optimization techniques. Discuss about


7 5 2 10
Function preserving transformations

8 Explain Loop optimization. What are the transformations to be performed in this? 5 2 10

9 Explain about Local or Peephole optimization 5 2 10

a) Explain about Global data flow analysis. 5


10 5 2
b) Explain about global optimization. 5

You might also like