# 10IS662/10CS63 Compiler Design VTU 6th Semester Question Bank

Visvesvaraya Technological University - VTU
Question Bank
B.E./B.Tech. DEGREE EXAMINATION
(Regulation/Scheme 2010)
10IS662/10CS63 Compiler Design
Sixth Semester - 6th
Computer Science Engineering - CSE
(Common to Information Science Engineering)

For more question paper of ISE

COMPILER DESIGN [10CS63]
QUESTION BANK

Unit 1:

1. Give the general structure of a complier. Show the working of different phases of
a complier taking an example. [june/jul 12] (10 Marks)
2. List and explain reasons for separating analysis portion of a complier into lexical
analysis and syntax analysis phases. [june/jul 12] (06 Marks)
3. Why two-buffer scheme is used in lexical analysis? Write an algorithm for “look
ahead code with sentinels”. [june/jul 12] (04 Marks)
4. Explain with a neat diagram, the phases of a compiler.[may/june 2010](10 Marks)
5. Construct a transition diagram for recognizing unsigned numbers. Sketch the
program segments to implement it, showing the first two states and one final state.
[may/june 2010] (10 Marks)
6. What is meant by input buffering ? Explain the use of sentinels in recognizing
tokens [june/jul 09] ( 08 Marks)
7. With the help of a diagram, explain the various phases of a compiler [june/jul 09](12 Marks)

Unit 2:

1. Show how left recursion and left factoring help top down parsing? [june/jul 12]
(06 Marks)
2. Give algorithm for FIRST and FOLLOW sets construction. Give the same for the
grammar. E  TE, E  TE/, T  FT, T  * FT/, F  (E)/id.
[june/jul 12] (08 Marks)
3. Explain the “panic-mode recovery” and “global correction” error recovery
strategies. [june/jul 12] (06 Marks)
4. Explain the left recursion and show how it is eliminated. Describe the algorithm
used for eliminating the left recursion. [may/june 2010] (6 Marks)
5. Eliminate left recursion from the grammar. [may/june 2010] (2 Marks)
6. Given the grammar S(L) |a L L, S| S [may/june 2010] (12 Marks)
a. Make necessary changes to make it suitable for LL (1) parsing.
b. Construction FIRST and FOLLOW sets
c. Construct the predictive parsing table
d. Show the moves made by the predictive parser on input(a, (a,a))
7. Briefly explain the problems associated with top-down parser
[june/jul 09] (04 marks)
8. Show that the grammar below is ambiguous. E → E + E | E * E | id Give an
unambiguous grammar for the above grammar such that + has higher priority, *
has less priority and both are right associative [june/jul 09] (08 marks)
9. Given the grammar
S → a | (L)
L → L, S | S
Do the necessary changes to make it suitable for LL (1) parser. Check the
resultant grammar is LL (1) or not. [june/jul 09] (08 marks)

Unit 3:

1. What is meant by handle pruning? How it helps in shift reduce parsing? List the
actions of a shift reduce parser. [june/jul 12] (10 Marks)
2. Show that the following grammar. S Aa Ab/ Bb Ba A  B is not
SLR (1) clearly mention the reasons. [june/jul 12] (10 Marks)
3. Obtain a set of canonical LR(0) items for the grammar [may/june 2010](8 Marks)
SL=R SR L *R Lid RL
4. Is the grammar in Q3 SLR (1) Give reasons. [may/june 2010](4 Marks)
5. What is handle pruning? Explain with the help of the grammar SSS+ |SS* | a
and input string aaa*a++. Give a bottom-up parse of the given input string
[may/june 2010] (8 Marks)
6. What is a shift reduce parser? Explain the conflicts that may occur during shift
reduce parsing. [june/jul 09] (04 marks)
7. Given the grammar A→(A) | a
a. Find LR (0) items
ii) Construct SLR (1) parsing table [june/jul 09] (08 marks)
8. Write SLR (1) parsing algorithm using the table constructed in 3b. show that
parsing steps for the string ((a)) [june/jul 09] ( 08 marks)

Unit 4:

1. Construct LR (1) items for SCc CcC/d, also construct GOTO graph for the
same grammar. [june/jul 12] (10 Marks)
2. How ambiguous grammars are handled by YACC? Develop unambiguous YACC
specification for a desktop calculator. [june/jul 12] (10 Marks)
3. Given the grammar SAA A Aa | b [may/june 2010] (12 marks)
a. Construct sets of LR(1) items
b. Construct canonical LR(1) parsing table
4. Write a note on the parser generator- Yacc [may/june 2010](4 marks)
5. Write the yacc specification of a simple desk calculator with the following
grammar for arithmetic expression [may/june 2010] (4 marks)
6. Write YACC specification to perform arithmetic operation[june/jul 09](04 marks)
7. Write an algorithm for constructing the canonical LR (1) parsing table. Construct
canonical LR(1) parsing table for
S →C C
C→ eC | d [june/jul 09] (16 marks)
PART B

Unit 5:

1. Define inherited and synthesized attributes. Give examples.
[june/jul 12] (05 Marks)
2. Define syntax directed definition for a simple type declaration.
[june/jul 12] (05 Marks)
3. Give a SDD for desktop calculator and show its stack implementation.
[june/jul 12] (10 Marks)
4. Explain the concept of syntax-directed definition. [may/june 2010](4 marks)
5. Consider the context-free-grammar given below. [may/june 2010](8 marks)
SEN EE+T|E-T|T TT*F|T/F|F F(E) |digit N;
a. Obtain the SDD for the above grammar.
b. Construct the parse tree, syntax tree and annotated parse tree for the input
string 5*6+7.
6. Construct post-fix SDT for the grammar in Q5.(b) and illustrate the corresponding
parse stack implementation. [may/june 2010] (8 marks)
7. Give the syntax directed definition to process a sample variable declaration in C
and construct dependency graph for the input float x,y,z [june/jul 09] (10 marks)
8. Assuming suitable syntax directed definition, construct a syntax tree for the
expression a-4+e [june/jul 09] (10 marks)

Unit 6:

1. List various three address instruction forms. Give one example for each.(10 M)
2. Write a note on quadruple and triples. [june/jul 12] (05 Marks)
3. Give a semantic action for S while (B) S. [june/jul 12] (05 Marks)
4. Obtain the directed acyclic graph for the expression a+a*(b-c) +(b-c)*d.Also give
the sequence of steps for constructing the same. [may/june 2010] (6marks)
5. Translate the arithmetic expression a+-(b+c) into quadruples, triples, and indirect
triples. [may/june 2010] (6marks)
6. Explain the syntax-directed translation of switch statement. [may/june 2010]
(8marks)
7. Describe the method of generating intermediate code for the flow control
statements [june/jul 09] (10 marks)
8. Explain the different types of representation of 3- address code. Generate 3-
address code for a < b or c
Unit 7:

1. With a diagram explain the typical subdivision of run time memory.
[june/jul 12] (08 Marks)
2. How access to non local data in the stack is done? [june/jul 12] (04 Marks)
3. Describe the general structure of an activation record. Explain the purpose of each
item in the activation record. [may/june 2010] (6 marks)
4. Explain in detail, the strategy for reducing fragmentation in heap memory.
[may/june 2010] (8 marks)
5. Explain briefly the performance metrics to be considered while designing a
garbage collector. [may/june 2010] (6 marks)
6. Explain in detail different dynamic storage allocation strategies [june/jul 09]
(10 marks)
7. Distinguish between static scope and dynamic scope. Briefly explain access to
non local names in static scope [june/jul 09] (10 marks)

Unit 8:

1. What is a basic block? How optimization is done in basic blocks?
[june/jul 12] (10 Marks)
2. Give the code generation process for an arithmetic operation. Generate
instructions for the statement, t = a–b, u = a–c, v = t + u.
[june/jul 12] (10 Marks)
3. Discuss the issues in the design of a code generator [may/june 2010](10 marks)
4. What are basic blocks and how do you partition a three address code into basic
blocks? [may/june 2010] (5 marks)
5. Write the three-address code and construct the basic blocks for the following
program segment. [may/june 2010] (5 marks)
6. Explain the code generation algorithm and generate code for the following
expression X = (a - b) + (a + c ) [june/jul 09] (10 marks)
7. Briefly explain main issues in code generation [june/jul 09] (10 marks)

Search Related to 10IS662/10CS63 Compiler Design

VTU BE syllabus 6th semester for 2010 Scheme
VTU Question Papers 6th semester
VTU Question Paper for sixth
Question Papers for CSE ISE VTU
10IS662/10CS63 Compiler Design vtu question papers
10IS662/10CS63 Compiler Design vtu notes
10IS662/10CS63 Compiler Design vtu syllabus
10IS662/10CS63 Compiler Design vtu notes 6th sem
10IS662/10CS63 Compiler Design notes vtu 6th sem ece