0% found this document useful (0 votes)
62 views

Compiler Design Bcs Ai 3d

This document contains questions divided into three groups - Group A, Group B and Group C. Group A contains 20 short answer questions related to compiler design topics like syntax trees, constant folding, error recovery etc. Group B contains 4 long answer questions related to code generation and optimization. Group C contains 10 long answer questions related to topics like lexical analysis, parsing, syntax directed translation, code optimization etc. The questions test knowledge of fundamental compiler design concepts and techniques.

Uploaded by

Sajal Kundu
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)
62 views

Compiler Design Bcs Ai 3d

This document contains questions divided into three groups - Group A, Group B and Group C. Group A contains 20 short answer questions related to compiler design topics like syntax trees, constant folding, error recovery etc. Group B contains 4 long answer questions related to code generation and optimization. Group C contains 10 long answer questions related to topics like lexical analysis, parsing, syntax directed translation, code optimization etc. The questions test knowledge of fundamental compiler design concepts and techniques.

Uploaded by

Sajal Kundu
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

Group-A

1. (Answer any ten questions) 2 x10 = 20


i) Differentiate between DAG and Syntax tree
ii) Write down the definition Constant Folding
iii) Define Common sub expression elimination
iv) Write shortly on Dead code elimination
v) Elaborate Define Loop unrolling
vi) Write shortly Code motion.
vii) What do you mean by context free grammar.
viii) What is Input Buffering?
ix) Explain the type of errors in compilers
x) List the different storage allocation strategies.
xi) What is phrase level error recovery?
xii) Define LR (0) items.
xiii) Find out the left factored grammar of the following:
S→c│a│ab
xiv) Compare lexeme and token in lexical analysis.
xv) Name different tokens in lexical analysis.
xvi) What are responsible for semantic rules?
xvii) Write down the uses of SDT?
xviii) Find out the no of tokens in the given code: Printf (“bcsai3=%d”,x);
xix) List down characteristics of LL (1) grammar.
xx) What is handle?

Group- B
(Answer all the following questions) 5x4 = 20
2. a. Generate 3 address code for the following program segment
If (x < y)
b = x;
Else
b = y;

b = b * b;

b. Generate 3AC and SSA codes for given code:


t1=b*c
t2=a+t1
t3=b*c
t4=d*t3
t5=t2+t4
2+3
3. a. Outline Left recursion and its types.
b. Eliminate the left recursion from the following grammar: A→ Aa│b
3+2
4. Compare different type of implementation of three address code. 5
5. Differentiate top-down parsing and bottom-up parsing with example. 5
6. a. Write down the properties of optimising compiler.
Page 1 of 4
b. Mentions the issues to be considered while applying the techniques for code
optimisation.
7. Describe analysis phase of a compiler with a block diagram.
8. What id error handling? Describe the panic mode and phase level error recovery
technique with example.
9. Describe the Code generation algorithm.
10. Explain in brief the various issues of design of a code generator.
11. Explain the symbol table management system.
12. Express the expression y=(a+b) *c in
a. Postfix notation
b. Syntax tree
c. Three address code
13. What is code optimisation? Optimize the following C-code
Count=0;
Result=0;
while (Count++<20)
{
Increment=2*count;
Result+= increment;
}
14. What is ambiguity in grammar? Justify whether the grammar is ambiguous or not.
15. a. What is DAG?
b. Draw the DAG for the following expression: a + (b*d) + c* (b*d) + e + a/(b*d)

Group C
(Answer all the following questions) 10x3 = 30
16. a. Write down the functionalities of lexical analysis with a diagram.
b. Find out the FIRST and FOLLOW of the given productions.
S→Aa│Bb│AB
A→Ꜫ │c
B→Ꜫ │d
c. Write down the control flow grapf for the given code:

17. Write any four of the following: 4 x 2.5


a. Three address code
b. Peephole optimization and its characteristics
c. Basic Block and its transformation
d. Symbol table.
e. YAAC
f. operator precedence parsing and its advantages and disadvantages

18. a. Draw the DAG for the expression: a + a * (b – c) + ( b – c ) * d


b. What is syntax tree? Draw the syntax tree for the above expression.
c. Write the three-address code for the following:
for (i = 1; i < 10; i++)

Page 2 of 4
if (a < 10)
a = a + b;
else
a = a-b;
d. What are the rules to compute FIRST and FOLLOW?
3+2+5+5
19. a. Describe with a block diagram the parsing technique of LL(1) parser. Parsing the string
‘((a))’ using LL(1) parser where the parsing table is given below.

a ( ) $
S S→a S→(L)
L L →(S) L→Ꜫ

b. Check whether the following grammar is LL(1) or not


X→Yz│a
Y→bZ│ Ꜫ
Z→Ꜫ

20. a. Describe LR parsing with block diagram.


b. What are the main advantages of LR parsing?
c. Construct SLR parsing table for the grammar given below.
S→ Ab
A→ bA│a
21. a. Construct DFA directly from the regular expression
L= (a│b)*ab
b. what are the main contribution of Syntax Directed Translation in Compiler?
c. mention different loop optimization techniques. Optimise the following code:
do{
item = 10;
x= x+item;
}while (value<50);

22. a. describe input buffering in lexical analyser.


b. Explain in brief various issues of design of a code generator
23. Define syntax directed definition. Explain the various forms of syntax directed definition.
24. a. Translate the arithmetic expression: (a+b) * (c+d) +(a+b+c)
i. three address code
ii. syntax tree
iii. quadruple
iv. triples
b. explain different storage allocation strategies.
25. a. what is compiler?
b. Explain the different phases of compiler with example
c. Compare and contrast between a compiler and an interpreter

Page 3 of 4
Page 4 of 4

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy