SlideShare a Scribd company logo
3
Most read
6
Most read
7
Most read
U21CS502 COMPILER DESIGN
Prepared by Dr.Nisha Soms Page 1
KPR INSTITUTE OF ENGINEERING AND TECHNOLOGY
(Autonomous)
ARASUR, COIMBATORE – 641407
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
Question Bank – Compiler Design
UNIT 1
1. What is Compiler? Design the Analysis and Synthesis Model of Compiler.
2. Write down the five properties of compiler.
3. What is translator? Write down the steps to execute a program.
4. Discuss all the phases of compiler with a with a diagram.
5. Write a short note on:
a. YACC
b. Pass
c. Bootstrapping
d. LEX Compiler
e. Tokens, Patterns and Lexemes
6. Write the steps to convert Non-Deterministic Finite Automata (NDFA) into Deterministic Finite
Automata (DFA).
7. Let M=({q0,q1}, {0,1}, ᵟ, q0, {q1}).
Be NFA where ᵟ(q0,0)={q0,q1}, ᵟ(q1,1) = {q1}
ᵟ(q1, 0)=ᵩ, ᵟ(q1, 1)={q0, q1}
Construct its equivalent DFA.
8. Convert the given NFA to DFA:
Input/State 0 1
 q0 {q0, q1} q0
q1 q2 q1
q2 q3 q3
q3 (final state) ᵩ (null character) q2
9. What is Regular Expression? Write the regular expression for:
a. R=R1+R2 (Union operation)
b. R=R1.R2 (concatenation Operation)
c. R=R1* (Kleen Clouser)
d. R=R+ (Positive Clouser)
e. Write a regular expression for a language containing strings which end with “abb” over
Ʃ= {a,b}.
f. Construct a regular expression for the language containing all strings having any
number of a’s and b’s except the null string.
10. Construct Deterministic Finite Automata to accept the regular expression :
(0+1)* (00+11) (0+1)*
U21CS502 COMPILER DESIGN
Prepared by Dr.Nisha Soms Page 2
11. How many phases are there in a compiler? Explain each phase in detail?
12. Describe the role of lexical analysis in compiler design?
13. Explain Input Buffering with simple examples?
14. Explain about Language Processor in compiler Design?
15. Explain the following terms
a. Specification of Tokens
b. Recognition of Tokens
16. a) Explain the Structure of Compiler?
b) What is the need for separating lexical analysis and syntax analysis?
17.Explain LEX Tool with an Lex Programme?
18. Write short notes
a. Pass and phases of a compiler
b. Bootstrapping
19. How to design the compiler by using the source program position:=intial+rate*60.
20. Write short notes
a. Application of compiler technology
b. Specification of Tokens
21. Write short notes on:
a. List the various phases of a compiler.
b. Differentiate tokens, patterns, and lexeme.
c. Differences between compiler and Interpreter.
d. Define Regular Expressions and Regular Grammar.
e. Error recovery strategies for a lexical analysis.
UNIT 2
1. Explain the parsing techniques with a hierarchical diagram.
2. What are the problems associated with Top Down Parsing?
3. Write the production rules to eliminate the left recursion and left factoring problems.
4. Consider the following Grammar:
A-> ABd|Aa|a
B-> Be|b
Remove left recursion.
5. Do left factoring in the following grammar:
A-> aAB|aA|a
B-> bB|b
6. Write a short notes on:
a. Ambiguity (with example)
b. Recursive Descent Parser
c. Predictive LL(1) parser (working)
d. Handle pruning
U21CS502 COMPILER DESIGN
Prepared by Dr.Nisha Soms Page 3
e. Operator Precedence Parser
7. Write Rules to construct FIRST Function and FOLLOW Function.
8. Consider theGrammar:
E-> E+T|T
T-> T*F|F
F-> (E)|id
Determine FIRST and FOLLOW.
9. Write the algorithm to create Predictive parsing table with the scanning of input string.
10. Show the following Grammar:
S-> AaAb|BbBa
A-> €
B-> €
Is the given graamar LL(1)? Parse the input string “ba”.
11. Consider the grammar:
E-> E+E
E-> E*E
E->id
Perform shift reduce parsing of the input string “id1+id2+id3”.
12. Write the properties of LR parser with its structure. Also explain the techniques of LR parser.
13. Write a short note on:
a. Augmented grammar
b. Kernel items
c. Rules of closure operation and goto operation
d. Rules to construct the LR(0) items
14. Consider the following grammar:
S-> Aa|bAc|Bc|bBa
A-> d
B-> d
Compute closure and goto.
15. Write the rules to construct the SLR parsing table.
16. Consider the following grammar:
E-> E+T|T
T-> TF|F
F-> F*|a|b
Construct the SLR parsing table and also parse the input “a*b+a”
17. Write the rules to construct the LR(1) items.
18. What is LALR parser? Construct the set of LR(1) items for this grammar:
S-> CC
C->aC
C->d
19. Show the following grammar
S->Aa|bAc|Bc|bd
Is LR(1) but not LALR(1).
20. Write the comparison among SLR Parser, LALR parser and Canonical LR Parser.
21. Construct the recursive decent parser for the following grammar
E-> E+T/T
T-> T*F/F
F-> (E)/id
22. Explain about Left factoring and Left Recursion with an example
23. Define augmented grammar. Construct the LR(0) items for the following Grammar
U21CS502 COMPILER DESIGN
Prepared by Dr.Nisha Soms Page 4
S->L=R
S->R
L->*R
L->id
R->L
24. Calculate FIRST and FOLLOW for the following grammar
a. E-> E+T/T
T-> T*F/F
F-> (E)/id
b. S->xABC
A->a|bbD
B->a|ε
C->b| ε
D->c| ε
25. Construct Predictive Parse Table for the grammar E->E+T/T,T->T*F/F,F->(E)|id and parse
the string id+id*id.
26. Perform Shift Reduce Parsing for the following
i) S->(L)|a
L->L,S|S input string: (a,(a,a))
ii) E-> E+E / E*E / (E) / id input string (id*id+id)
27. Construct CLR Parsing table for the given grammar
S->CC
C->aC/d
28. Consider the grammar
S->AB|ABad
A->d
E ->b
D->b| ε
B->c
Construct the predictive parsing table. Show that the given grammar is LL(1) or not
UNIT 3
1. What is syntax directed translation (SDD)?
2. Write short note on:
a. Synthesized attributes
b. Inherited attributes
c. Dependency graph
d. Evaluation order
e. Directed Acyclic Graph (DAG)
3. Draw the syntax tree and DAG for the following
expression: (a*b)+(c-d)*(a*b)+b
4. Differentiate between synthesized translation and inherited translation.
5. What is intermediate code and write the two benefits of intermediate code generation.
6. Write the short note on:
a. Abstract syntax tree
U21CS502 COMPILER DESIGN
Prepared by Dr.Nisha Soms Page 5
b. Polish notation
c. Three address code
d. Backpatching
7. Construct syntax tree and postfix notation for the following expression:
(a+(b*c)^d-e/(f+g)
8. Write quadruples, triples and indirect triples for the expression:
(a*b)+(c+d)-(a+b+c+d)
9. Write the three address statement with example for:
a. Assignment
b. Unconditional jump (goto)
c. Array statement (2D and 3D)
d. Boolean expression
e. If-then-else statement
f. While, do-while statement
g. Switch case statement
10. Explain syntax directed definition with simple examples
11. Describe the evaluation order of SDT with an example.
12. Explain the Type Checking with suitable examples
13. Explain the Translation scheme of SDD.
14. Describe the representation of 3-address code with an example.
15. Explain in detail about Backpatching Technique
16. Explain the applications of Syntax Directed Definition.
17. Write down the translation procedure for control statement
18. Explain different types of intermediate code representations
19. a) Define a syntax-directed translation.
b) Define annotated parse tree.
c) What are the three functions of backpatching?
d) Write the Syntax of case statement?.
e) Differentiate between L attribute and S attribute.
UNIT 4
1. Write the definition of symbol table and procedure to store the names in symbol table.
2. What are the data structures used in symbol table?
3. What are the limitations of stack allocation?
4. Write two important points about heap management.
5. Write the comparison among Static allocation, Stack allocation and Heap Allocation
with their merits and limitations.
6. What is activation record? Write the various fields of Activation Record.
7. What are the functions of error handler?
8. Write a short note on Error Detection and Recovery.
9. Classify the errors and discuss the errors in each phase of Compiler.
10. Draw the format of Activation Record in stack allocation and explain each field in it.
11. Explain about Global data flow analysis.
12. Explain the Storage Organization with simple examples.
13. Define Symbol table. Explain different types of Data structure for symbol table
U21CS502 COMPILER DESIGN
Prepared by Dr.Nisha Soms Page 6
14. Distinguish between static scope and dynamic scope. Briefly explain
access to non-local Names in static scope.
15. Explain the Non Block Structured Languages?
16. Explain Storage allocation strategies with suitable examples?
17. Explain heap management mechanism.
18. Explain about block structured language.
19. Define Activation Record.
20. Name any four procedural optimization techniques
21. Define scope and life time of variable.
22. Define symbol table.
23. Define data flow equation?
UNIT 5
1. Write about all issues in code generation. Describe it.
2. Explain the target machine architecture?
3. Explain optimization techniques on Basic Blocks with simple examples?
4. Describe the various strategies in register allocation.
5. Explain the peephole optimization Technique?.
6. Construct the DAG for following statement. a+b*c+d+b*c
7. Construct the DAG for the following basic blocks
1. t1:=4*i
2. t2:=a[t1]
3. t3:=4*i
4. t4:=b[t3]
5. t5:=t2*t4
6. t6:=prod+t5
7. prod:=t6
8. t7:=i+1
9. i:=t7
10. if i<=20 goto 1
8. Explain the simple code generator and generate target code sequence for the
following statement d:=(a-b)+(a-c)+(a-c)
9. Write short notes on i)Simple code generator ii)Register allocation
10. Explain the following terms
a) Role of peephole optimization in compilation process
b) Issues in the design of a code generator.(any 4)
c) Give the different forms in target program
d) Give the applications of DAG.
e) Define Dead-code elimination with example.
U21CS502 COMPILER DESIGN
Prepared by Dr.Nisha Soms Page 7
11. What are the properties of code generation phase? Also explain the Design Issues of this phase.
12.What are basic blocks? Write the algorithm for partitioning into Blocks.
13.Write a short note on:
a. Flow graph (with example)
b. Dominators
c. Natural loops
d. Inner loops
14. Consider the following program
code:
Prod=0;
I=1;
Do{
Prod=prod+a[i]*b[i]
; I=i+1;
}while (i<=10);
a. Partition in into blocks
b. Construct the flow graph
15. What is code optimization? Explain machine dependent and independent code optimization.
16. What is common sub-expression and how to eliminate it? Explain with example.
17. Write a short note with example to optimize the code:
a. Dead code elimination
b. Variable elimination
c. Code motion
d. Reduction in strength
18. What is control and data flow analysis? Explain with example.

More Related Content

DOCX
Cs6660 compiler design may june 2017 answer key
PDF
17431 microprocessor &amp; programming
DOC
Data structures question paper anna university
PDF
Compiler gate question key
PDF
6th Semester (June; July-2015) Computer Science and Information Science Engin...
PDF
7th Semester (June; July-2015) Computer Science and Information Science Engin...
PDF
Mcs 10 104 compiler design dec 2014
PDF
Ec2203 digital electronics questions anna university by www.annaunivedu.org
Cs6660 compiler design may june 2017 answer key
17431 microprocessor &amp; programming
Data structures question paper anna university
Compiler gate question key
6th Semester (June; July-2015) Computer Science and Information Science Engin...
7th Semester (June; July-2015) Computer Science and Information Science Engin...
Mcs 10 104 compiler design dec 2014
Ec2203 digital electronics questions anna university by www.annaunivedu.org

Similar to U21CS502--Compiler Design--Question Bank (20)

DOCX
Cs6660 compiler design may june 2016 Answer Key
PDF
System software
PDF
5th Semester (June; July-2015) Computer Science and Information Science Engin...
PPTX
ISA.pptx
DOC
141303 qb
PDF
Vtu cs 7th_sem_question_papers
PPTX
Bsc math previous exam quetions
PDF
2013-June: 5th Semester CSE / ISE Question Papers
PDF
5th Semester CS / IS (2013-June) Question Papers
PDF
5th semester Computer Science and Information Science Engg (2013 December) Qu...
DOCX
COMP 2213X2 Assignment #2 Parts A and BDue February 3 in cla.docx
DOCX
Cs8251 faq1
PDF
Object Oriented Programming using C++ PCIT102.pdf
PDF
Assignment 1
PDF
Automata And Compiler Design
PDF
6th Semester (Dec-2015; Jan-2016) Computer Science and Information Science En...
PPTX
Principal Sources of Optimization in compiler design
DOC
CS8391 Data Structures Part B Questions Anna University
PPTX
6 assembly language computer organization
DOCX
Smu bscit sem 2 fall 2014 assignments
Cs6660 compiler design may june 2016 Answer Key
System software
5th Semester (June; July-2015) Computer Science and Information Science Engin...
ISA.pptx
141303 qb
Vtu cs 7th_sem_question_papers
Bsc math previous exam quetions
2013-June: 5th Semester CSE / ISE Question Papers
5th Semester CS / IS (2013-June) Question Papers
5th semester Computer Science and Information Science Engg (2013 December) Qu...
COMP 2213X2 Assignment #2 Parts A and BDue February 3 in cla.docx
Cs8251 faq1
Object Oriented Programming using C++ PCIT102.pdf
Assignment 1
Automata And Compiler Design
6th Semester (Dec-2015; Jan-2016) Computer Science and Information Science En...
Principal Sources of Optimization in compiler design
CS8391 Data Structures Part B Questions Anna University
6 assembly language computer organization
Smu bscit sem 2 fall 2014 assignments
Ad

More from NISHASOMSCS113 (18)

PPTX
CN module for the fourth od momodule.ppt
PPTX
CN module for the second od momodule.ppt
PPTX
CN module for the first mod momodule.ppt
PPT
Foundation of computerr nnetworks strong
PPT
Data and Signals ppt in physical layersn
PPTX
Assymmetric Cryptosystem in cryptography
PPT
Data communications and networking basics
PPT
Data Transmission chapter from stallings
PPTX
Building blocks of Algblocks of Alg.pptx
PPT
dokumen.tips_1-cryptography-and-network-security-third-edition-by-william-sta...
PPTX
Unit 1.pptx
PPTX
Exception handling.pptx
PPTX
Introduction to Information Storage.pptx
PPT
recursion.ppt
PPTX
social.pptx
PPTX
Data Management.pptx
PPT
intro to sna.ppt
PPT
intro.ppt
CN module for the fourth od momodule.ppt
CN module for the second od momodule.ppt
CN module for the first mod momodule.ppt
Foundation of computerr nnetworks strong
Data and Signals ppt in physical layersn
Assymmetric Cryptosystem in cryptography
Data communications and networking basics
Data Transmission chapter from stallings
Building blocks of Algblocks of Alg.pptx
dokumen.tips_1-cryptography-and-network-security-third-edition-by-william-sta...
Unit 1.pptx
Exception handling.pptx
Introduction to Information Storage.pptx
recursion.ppt
social.pptx
Data Management.pptx
intro to sna.ppt
intro.ppt
Ad

Recently uploaded (20)

PPTX
Fundamentals of safety and accident prevention -final (1).pptx
PDF
737-MAX_SRG.pdf student reference guides
PDF
III.4.1.2_The_Space_Environment.p pdffdf
PDF
Level 2 – IBM Data and AI Fundamentals (1)_v1.1.PDF
PPTX
Fundamentals of Mechanical Engineering.pptx
PPTX
"Array and Linked List in Data Structures with Types, Operations, Implementat...
PPTX
6ME3A-Unit-II-Sensors and Actuators_Handouts.pptx
PPTX
communication and presentation skills 01
PPTX
AUTOMOTIVE ENGINE MANAGEMENT (MECHATRONICS).pptx
PDF
EXPLORING LEARNING ENGAGEMENT FACTORS INFLUENCING BEHAVIORAL, COGNITIVE, AND ...
PDF
Design Guidelines and solutions for Plastics parts
PDF
Visual Aids for Exploratory Data Analysis.pdf
PPTX
Graph Data Structures with Types, Traversals, Connectivity, and Real-Life App...
PDF
Abrasive, erosive and cavitation wear.pdf
PDF
A SYSTEMATIC REVIEW OF APPLICATIONS IN FRAUD DETECTION
PPTX
Nature of X-rays, X- Ray Equipment, Fluoroscopy
PPTX
Safety Seminar civil to be ensured for safe working.
PDF
BIO-INSPIRED HORMONAL MODULATION AND ADAPTIVE ORCHESTRATION IN S-AI-GPT
PDF
22EC502-MICROCONTROLLER AND INTERFACING-8051 MICROCONTROLLER.pdf
PPTX
Artificial Intelligence
Fundamentals of safety and accident prevention -final (1).pptx
737-MAX_SRG.pdf student reference guides
III.4.1.2_The_Space_Environment.p pdffdf
Level 2 – IBM Data and AI Fundamentals (1)_v1.1.PDF
Fundamentals of Mechanical Engineering.pptx
"Array and Linked List in Data Structures with Types, Operations, Implementat...
6ME3A-Unit-II-Sensors and Actuators_Handouts.pptx
communication and presentation skills 01
AUTOMOTIVE ENGINE MANAGEMENT (MECHATRONICS).pptx
EXPLORING LEARNING ENGAGEMENT FACTORS INFLUENCING BEHAVIORAL, COGNITIVE, AND ...
Design Guidelines and solutions for Plastics parts
Visual Aids for Exploratory Data Analysis.pdf
Graph Data Structures with Types, Traversals, Connectivity, and Real-Life App...
Abrasive, erosive and cavitation wear.pdf
A SYSTEMATIC REVIEW OF APPLICATIONS IN FRAUD DETECTION
Nature of X-rays, X- Ray Equipment, Fluoroscopy
Safety Seminar civil to be ensured for safe working.
BIO-INSPIRED HORMONAL MODULATION AND ADAPTIVE ORCHESTRATION IN S-AI-GPT
22EC502-MICROCONTROLLER AND INTERFACING-8051 MICROCONTROLLER.pdf
Artificial Intelligence

U21CS502--Compiler Design--Question Bank

  • 1. U21CS502 COMPILER DESIGN Prepared by Dr.Nisha Soms Page 1 KPR INSTITUTE OF ENGINEERING AND TECHNOLOGY (Autonomous) ARASUR, COIMBATORE – 641407 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING Question Bank – Compiler Design UNIT 1 1. What is Compiler? Design the Analysis and Synthesis Model of Compiler. 2. Write down the five properties of compiler. 3. What is translator? Write down the steps to execute a program. 4. Discuss all the phases of compiler with a with a diagram. 5. Write a short note on: a. YACC b. Pass c. Bootstrapping d. LEX Compiler e. Tokens, Patterns and Lexemes 6. Write the steps to convert Non-Deterministic Finite Automata (NDFA) into Deterministic Finite Automata (DFA). 7. Let M=({q0,q1}, {0,1}, ᵟ, q0, {q1}). Be NFA where ᵟ(q0,0)={q0,q1}, ᵟ(q1,1) = {q1} ᵟ(q1, 0)=ᵩ, ᵟ(q1, 1)={q0, q1} Construct its equivalent DFA. 8. Convert the given NFA to DFA: Input/State 0 1  q0 {q0, q1} q0 q1 q2 q1 q2 q3 q3 q3 (final state) ᵩ (null character) q2 9. What is Regular Expression? Write the regular expression for: a. R=R1+R2 (Union operation) b. R=R1.R2 (concatenation Operation) c. R=R1* (Kleen Clouser) d. R=R+ (Positive Clouser) e. Write a regular expression for a language containing strings which end with “abb” over Ʃ= {a,b}. f. Construct a regular expression for the language containing all strings having any number of a’s and b’s except the null string. 10. Construct Deterministic Finite Automata to accept the regular expression : (0+1)* (00+11) (0+1)*
  • 2. U21CS502 COMPILER DESIGN Prepared by Dr.Nisha Soms Page 2 11. How many phases are there in a compiler? Explain each phase in detail? 12. Describe the role of lexical analysis in compiler design? 13. Explain Input Buffering with simple examples? 14. Explain about Language Processor in compiler Design? 15. Explain the following terms a. Specification of Tokens b. Recognition of Tokens 16. a) Explain the Structure of Compiler? b) What is the need for separating lexical analysis and syntax analysis? 17.Explain LEX Tool with an Lex Programme? 18. Write short notes a. Pass and phases of a compiler b. Bootstrapping 19. How to design the compiler by using the source program position:=intial+rate*60. 20. Write short notes a. Application of compiler technology b. Specification of Tokens 21. Write short notes on: a. List the various phases of a compiler. b. Differentiate tokens, patterns, and lexeme. c. Differences between compiler and Interpreter. d. Define Regular Expressions and Regular Grammar. e. Error recovery strategies for a lexical analysis. UNIT 2 1. Explain the parsing techniques with a hierarchical diagram. 2. What are the problems associated with Top Down Parsing? 3. Write the production rules to eliminate the left recursion and left factoring problems. 4. Consider the following Grammar: A-> ABd|Aa|a B-> Be|b Remove left recursion. 5. Do left factoring in the following grammar: A-> aAB|aA|a B-> bB|b 6. Write a short notes on: a. Ambiguity (with example) b. Recursive Descent Parser c. Predictive LL(1) parser (working) d. Handle pruning
  • 3. U21CS502 COMPILER DESIGN Prepared by Dr.Nisha Soms Page 3 e. Operator Precedence Parser 7. Write Rules to construct FIRST Function and FOLLOW Function. 8. Consider theGrammar: E-> E+T|T T-> T*F|F F-> (E)|id Determine FIRST and FOLLOW. 9. Write the algorithm to create Predictive parsing table with the scanning of input string. 10. Show the following Grammar: S-> AaAb|BbBa A-> € B-> € Is the given graamar LL(1)? Parse the input string “ba”. 11. Consider the grammar: E-> E+E E-> E*E E->id Perform shift reduce parsing of the input string “id1+id2+id3”. 12. Write the properties of LR parser with its structure. Also explain the techniques of LR parser. 13. Write a short note on: a. Augmented grammar b. Kernel items c. Rules of closure operation and goto operation d. Rules to construct the LR(0) items 14. Consider the following grammar: S-> Aa|bAc|Bc|bBa A-> d B-> d Compute closure and goto. 15. Write the rules to construct the SLR parsing table. 16. Consider the following grammar: E-> E+T|T T-> TF|F F-> F*|a|b Construct the SLR parsing table and also parse the input “a*b+a” 17. Write the rules to construct the LR(1) items. 18. What is LALR parser? Construct the set of LR(1) items for this grammar: S-> CC C->aC C->d 19. Show the following grammar S->Aa|bAc|Bc|bd Is LR(1) but not LALR(1). 20. Write the comparison among SLR Parser, LALR parser and Canonical LR Parser. 21. Construct the recursive decent parser for the following grammar E-> E+T/T T-> T*F/F F-> (E)/id 22. Explain about Left factoring and Left Recursion with an example 23. Define augmented grammar. Construct the LR(0) items for the following Grammar
  • 4. U21CS502 COMPILER DESIGN Prepared by Dr.Nisha Soms Page 4 S->L=R S->R L->*R L->id R->L 24. Calculate FIRST and FOLLOW for the following grammar a. E-> E+T/T T-> T*F/F F-> (E)/id b. S->xABC A->a|bbD B->a|ε C->b| ε D->c| ε 25. Construct Predictive Parse Table for the grammar E->E+T/T,T->T*F/F,F->(E)|id and parse the string id+id*id. 26. Perform Shift Reduce Parsing for the following i) S->(L)|a L->L,S|S input string: (a,(a,a)) ii) E-> E+E / E*E / (E) / id input string (id*id+id) 27. Construct CLR Parsing table for the given grammar S->CC C->aC/d 28. Consider the grammar S->AB|ABad A->d E ->b D->b| ε B->c Construct the predictive parsing table. Show that the given grammar is LL(1) or not UNIT 3 1. What is syntax directed translation (SDD)? 2. Write short note on: a. Synthesized attributes b. Inherited attributes c. Dependency graph d. Evaluation order e. Directed Acyclic Graph (DAG) 3. Draw the syntax tree and DAG for the following expression: (a*b)+(c-d)*(a*b)+b 4. Differentiate between synthesized translation and inherited translation. 5. What is intermediate code and write the two benefits of intermediate code generation. 6. Write the short note on: a. Abstract syntax tree
  • 5. U21CS502 COMPILER DESIGN Prepared by Dr.Nisha Soms Page 5 b. Polish notation c. Three address code d. Backpatching 7. Construct syntax tree and postfix notation for the following expression: (a+(b*c)^d-e/(f+g) 8. Write quadruples, triples and indirect triples for the expression: (a*b)+(c+d)-(a+b+c+d) 9. Write the three address statement with example for: a. Assignment b. Unconditional jump (goto) c. Array statement (2D and 3D) d. Boolean expression e. If-then-else statement f. While, do-while statement g. Switch case statement 10. Explain syntax directed definition with simple examples 11. Describe the evaluation order of SDT with an example. 12. Explain the Type Checking with suitable examples 13. Explain the Translation scheme of SDD. 14. Describe the representation of 3-address code with an example. 15. Explain in detail about Backpatching Technique 16. Explain the applications of Syntax Directed Definition. 17. Write down the translation procedure for control statement 18. Explain different types of intermediate code representations 19. a) Define a syntax-directed translation. b) Define annotated parse tree. c) What are the three functions of backpatching? d) Write the Syntax of case statement?. e) Differentiate between L attribute and S attribute. UNIT 4 1. Write the definition of symbol table and procedure to store the names in symbol table. 2. What are the data structures used in symbol table? 3. What are the limitations of stack allocation? 4. Write two important points about heap management. 5. Write the comparison among Static allocation, Stack allocation and Heap Allocation with their merits and limitations. 6. What is activation record? Write the various fields of Activation Record. 7. What are the functions of error handler? 8. Write a short note on Error Detection and Recovery. 9. Classify the errors and discuss the errors in each phase of Compiler. 10. Draw the format of Activation Record in stack allocation and explain each field in it. 11. Explain about Global data flow analysis. 12. Explain the Storage Organization with simple examples. 13. Define Symbol table. Explain different types of Data structure for symbol table
  • 6. U21CS502 COMPILER DESIGN Prepared by Dr.Nisha Soms Page 6 14. Distinguish between static scope and dynamic scope. Briefly explain access to non-local Names in static scope. 15. Explain the Non Block Structured Languages? 16. Explain Storage allocation strategies with suitable examples? 17. Explain heap management mechanism. 18. Explain about block structured language. 19. Define Activation Record. 20. Name any four procedural optimization techniques 21. Define scope and life time of variable. 22. Define symbol table. 23. Define data flow equation? UNIT 5 1. Write about all issues in code generation. Describe it. 2. Explain the target machine architecture? 3. Explain optimization techniques on Basic Blocks with simple examples? 4. Describe the various strategies in register allocation. 5. Explain the peephole optimization Technique?. 6. Construct the DAG for following statement. a+b*c+d+b*c 7. Construct the DAG for the following basic blocks 1. t1:=4*i 2. t2:=a[t1] 3. t3:=4*i 4. t4:=b[t3] 5. t5:=t2*t4 6. t6:=prod+t5 7. prod:=t6 8. t7:=i+1 9. i:=t7 10. if i<=20 goto 1 8. Explain the simple code generator and generate target code sequence for the following statement d:=(a-b)+(a-c)+(a-c) 9. Write short notes on i)Simple code generator ii)Register allocation 10. Explain the following terms a) Role of peephole optimization in compilation process b) Issues in the design of a code generator.(any 4) c) Give the different forms in target program d) Give the applications of DAG. e) Define Dead-code elimination with example.
  • 7. U21CS502 COMPILER DESIGN Prepared by Dr.Nisha Soms Page 7 11. What are the properties of code generation phase? Also explain the Design Issues of this phase. 12.What are basic blocks? Write the algorithm for partitioning into Blocks. 13.Write a short note on: a. Flow graph (with example) b. Dominators c. Natural loops d. Inner loops 14. Consider the following program code: Prod=0; I=1; Do{ Prod=prod+a[i]*b[i] ; I=i+1; }while (i<=10); a. Partition in into blocks b. Construct the flow graph 15. What is code optimization? Explain machine dependent and independent code optimization. 16. What is common sub-expression and how to eliminate it? Explain with example. 17. Write a short note with example to optimize the code: a. Dead code elimination b. Variable elimination c. Code motion d. Reduction in strength 18. What is control and data flow analysis? Explain with example.