0% found this document useful (0 votes)
88 views4 pages

Cs 701 Compiler

The document contains details about a compiler design theory assignment for computer science students. It includes 15 questions divided into 3 groups related to topics like compilers, interpreters, grammars, parsing, syntax analysis, code generation and optimization. The questions range from basic concepts to more advanced topics involving code translation, tree construction, grammar properties, optimization techniques etc.

Uploaded by

parth444
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
88 views4 pages

Cs 701 Compiler

The document contains details about a compiler design theory assignment for computer science students. It includes 15 questions divided into 3 groups related to topics like compilers, interpreters, grammars, parsing, syntax analysis, code generation and optimization. The questions range from basic concepts to more advanced topics involving code translation, tree construction, grammar properties, optimization techniques etc.

Uploaded by

parth444
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Department of CS/IT

THEORY ASSIGNMENT
Branch: CSE(7
th
sem)
Subject: COMPILER DESIGN

GROUP A- (0502CS091001 0502CS091007)
QUESTION
NUMBER
QUESTION UNIT
1.
What is compiler? Why do we need compiler?
1
2.
What is Interpreter?
1
3.
.Explain the role of lexical analyzer, syntax analyzer and semantic analyzer in
detail.
1
4.
Write a CFG, which generate string of balanced parenthesis.
2
5.
Consider the CFG
SXX
X XXX/ bX/ Xb/a
Find the parse tree for the string bbaaaab
2
6.
What do you understand by Parse Tree? What is left most derivation? What is
right most derivation?
2
7.
1. Finding leading and trailing for the following grammer.
EE+T | E
TT*F | T
F(E) | id
3
8.
Design operator precedence parser for the above grammar.
3
9.
What is syntax directed translator?
3
10.
Find the postfix notation for the following:
1) a + b*(c+d)e/f*(g/h)-i
2) -(a+b)*cd+e/(a+b+cd)-g+h/i
4
11.
Construct syntax tree for the following:
i) 1)a + b*(c+d)e/f*(g/h)-i
ii) 2)-(a+b)*cd+e/(a+b+cd)-g+h/i
4
12.
Write three address code for a + b*(c+d)e/f*(g/h)-i
Quadruple
Tripple
Indirect Tripple
4
13. 1. Construct DAG for the following
a+b*(c+d)e/f(g/h)-i
5
14. What is DAG? 5
15. Write an algorithm to find basic building block. 5
GROUP B(0502CS091008-0502CS091016)



QUESTION
NUMBER
QUESTION UNIT
1.
What is assembler?
1
2.
Explain the phases of compiler.
1
3.
Explain the difference between compiler and interpreter.
1
4.
Write a CFG, which generate string of balanced parenthesis.
2
5.
Consider the CFG
SaAS/a
ASbA/SS/ba
Show that Saabbaa
2
6.
What do you understand by Parse Tree?
2
7.
1. Annotate the following grammer to count how many reduction are to be performed
for the string id+id*id:
EE+T | E
TT*F | T
F(E) | id
3
8.
What is dynamic storage allocation?
3
9.
2. Discuss the following storage allocation strategies:
Stack allocation
Heap allocation
3
10.
What is Peep Hole Optimization?
4
11.
Translate the given expression, by three address code and also give
quaruple.a:= -b * (c+d)
4
12.
Write the intermediate code for
While(A<C) and B>D
{
If(A=1)
Then C=C+1
Else
While(A<=D)
{
A=A+B
}}
4
13.
What is brute force parsing technique? What is recursive descent parser.
5
14.
What are the major issues for code generation?
5
15.
What is the register allocation?
5

GROUP C(0502CS091017-0502CS091020)
QUESTION
NUMBER
QUESTION UNIT
1.
What are the advantage and disadvantages for both single pass and multi-pass
compiler?
1
2.
What are the issues in lexical analyzer?
1
3.
What is porting?
1
4.
Consider a CFG
SAB/a
Ab
Identified and eliminate useless symbols.
2
5.
Find the reduced grammar that is equivalent to the CFG
SaC/Sb
AbSCa
BaSB/bBC
CaBC/ad

2
6.
Remove the left recursion from the following grammar:
S SSa/Ab/c
A AAb/d
2
7.
Write the syntax directed translation to go alongwith the LR parser for the
following:
S AE
ADS while
Ddo
3
8.
Consider the following syntax directed translation
E E1 * T {E.val=E1.val* T. val}
E T {E.val=T.val }
T T1 F {T.val=T1.val-F.val}
T F {T.val=F.val}
F 2 {F.val=2}
F 4 {F.val=4}
Using the above SDTS, construct a parse tree for the expression: 4 2 4 * 2 also
compute its E. val
3
9.
What are the advanced type checking?
3
10.
Consider the foolowing grammar:
E E + T
E T
T T* F
T F
Fid
And write the intermediate code for expression a + b * c as:
i) Postfix representation
ii) Syntax tree representation
4
11.
For the following program fragment:
Sum=0
For ( j=1 ; j <=10 ; j++)
Sum = sum + a[j] + b[j]
Generate the three address code. There are 8-byte per word.

4





12.
Consider the following switch statement:
Switch ( i+j)
{
Case 1: x=y+z
Default: p=q+r
Case 2: u=v+w
}
And write the translation scheme to translate the above program fragment into three
address code.
4
13.
What is Loop optimization?
5
14.
When dangling references
5
15.
What do you mean by dead code ?
5

You might also like