Course Plan: DSEC/CSE/CS8602/III/VI
Course Plan: DSEC/CSE/CS8602/III/VI
COURSE PLAN
Syllabus:
No. of
UNIT I INTRODUCTION TO COMPILERS
Periods 12
Structure of a compiler – Lexical Analysis – Role of lexical analyzer – Input Buffering – Specification
of Tokens – Recognition of Tokens – Lex – Finite Automata – Regular Expressions to Automata –
Minimizing DFA.
No. of
UNIT II SYNTAX ANALYSIS Periods 12
Role of Parser – Grammars – Error Handling – Context free grammars – Writing a grammar – Top Down
Parsing- General Strategies Recursive Descent Parser Predictive Parser – LL(1) Parser – Shift Reduce Parser –
LR Parser – LR(0) Item construction of SLR Parsing Table – Introduction to LALR Parser – Error Handling and
Recovery in Syntax Analyzer – YACC.
No. of
UNIT III INTERMEDIATE CODE GENERATION Periods 12
Syntax Directed Definitions – Evaluation of orders for Syntax Directed Definitions – Intermediate Languages:
Syntax tree, Three address code - Types and Declarations – Translation of Expressions – Type checking.
No. of
UNIT IV RUN-TIME ENVIRONMENT AND CODE GENERATION Periods 12
Storage organization, Stack allocation Space, Access to Non local Data on the stack – Heap management –
Issues in Code Generation - Design of a simple code generator.
No. of
UNIT V CODE OPTIMIZATION Periods 12
Principal Sources of Optimization – Peep hole optimization – DAG – Optimization of basic blocks – Global
Data Flow Analysis – Efficient Data Flow Algorithm
1
DSEC/CSE/CS8602/III/VI
Objective:
T1: Alfred V.Aho, Monica S.Lam, Ravi Sethi, Jeffrey D.Ullman, Compilers: Principles, Techniques
and ToolsII, Second Edition, Pearson Education, 2009.
Reference Book:
R1. Randy Allen, Ken Kennady, Optimizing Compilers for Modern Architectures: A Dependence
based Approach, Morgan Kaufmann Publishers, 2002.
R2. Steven S.Muchnick, Advanced Compiler Design and Implementation II, Morgan Kaufmann
Publishers – Elsevier Science, India, Indian Reprint 2003.
R3. Keith D Cooper and Linda Torczon, Engineering a Compiler II, Morgan Kaufmann Publishers –
Elsevier Science, 2004.
R4. V.Raghavan, Principles of Compiler Design II, Tata McGraw Hill Education Publishers, 2010.
R5. Allen I. Holub, Compiler Design in C II, Prentice – Hall Software Series, 1993.
Website:
W1: https://www.tutorialspoint.com/compiler_design/index.html
W2:https://www.tutorialspoint.com/compiler_design/compiler_design_types_of_parsing
W3: https://www.slideshare.net/fellowbuddy/compiler-design-lecture-notes
W4: https://ecomputernotes.com/compiler-design/convert-regular-expression-to-dfa
W5: www.geeksforgeeks.org/types-of-parsers-in-compiler-design/
https://nptel.ac.in/courses/106/105/106105190/
https://onlinecourses.nptel.ac.in/noc21_cs07/preview
https://nptel.ac.in/noc/courses/noc19/SEM1/noc19-cs01/
2
DSEC/CSE/CS8602/III/VI
Course Plan:
17 LR Parser T1 241-252 BB 1 20
3
DSEC/CSE/CS8602/III/VI
19 Introduction to LALR Parser T1 266-275 BB 1 22
Error Handling and Recovery in T1
20 194-195 BB 1 23
Syntax Analyzer
21 YACC. T1 287-295 BB 1 24
Outcome of Unit II:
At the end of unit, Students should be able to
Apply different parsing algorithms to develop parsers for a given grammar.
Understand Context free grammars.
Design a parser for a grammars.
UNIT – III INTERMEDIATE CODE GENERATION 12
Intermediate code T1 BB 1 25
303-304
22 generation
Syntax Directed
T1 304-306 BB 2 27
23 Definitions
Evaluation of orders for Syntax
24 T1 310-314 BB 2 29
Directed Definitions
Intermediate Languages: Syntax
25 T1 358-360 BB 2 31
tree
26 Three address code T1 363-369 BB 1 32
41 DAG W3 BB 2 55
T1
42 Optimization of basic blocks 533-539 BB 1 56
T1
43 Global Data Flow Analysis BB 1 57
W3
44 Data Flow Algorithm BB 2 59
W1
45 Efficient Data Flow Algorithm BB 1 60
W5
Outcome of Unit V:
At the end of unit, Students should be able to
Understand various code optimization techniques.
Design Data Flow Algorithms.
Course Outcome:
At the end of course:(Consolidated outcome)
Students should be able to :
CO1: Understand the different phases of compiler.
CO2: Design a lexical analyzer for sample language.
CO3: Apply different parsing algorithms to develop parsers for a given grammar.
CO4: Understand syntax directed translation and run time environment.
CO5: Design a simple code generator.
CO PO1 PO2 PO3 PO4 PO5 PO6 PO7 PO8 PO9 PO10 PO11 PO12
CO 1 3 0 0 0 0 0 0 0 0 0 0 0
CO 2 0 3 0 0 2 0 0 0 0 0 0 0
CO 3 0 0 3 0 2 0 0 0 0 0 0 0
CO 4 0 0 0 2 0 0 0 0 0 1 0 2
CO 5 0 0 0 0 0 0 0 1 1 0 0 0
Assignment:
ASSIGNMENT I
Batch Register Number Total Mode of Assignment Topics
Details Number Written/Seminar/
PPT
Convert Regular Expression into DFA
Batch 1 814319104001-18 18 Written (i) (a/b)*abb(a/b)*
(ii) (a*/b*)*
(iii) (0+1)*(0+1)10
1. Structure of compiler
ASSIGNMENT II
1. Evaluation Orders of SDD
Batch 1 814319104001-18 18 Seminar
2. Storage Organization of Run time
environment
3. Design of simple code generator.
6
DSEC/CSE/CS8602/III/VI
Create DAG and three address code for
the following C program
Batch 2 814319104019-39 18 Written i=1; s=0;
while (i<=10)
{
s=s+a[i][i];
i=i+1;
}
1. Optimization of basic blocks.
Batch 3 814319104040-60 17 Seminar 2. Global data flow analysis.
3. Efficient data flow algorithm.
SIM Questions:
SIM 1 1. Analyze the structure of compiler with an assignment statement.
2. Design in detail about issues in lexical analysis. (M/J 17) (N/D 16)
3. Discuss how a finite automaton is used to represent tokens and perform
lexical analysis with examples. (M/J 17)
4. Draw a DFA for the regular expression ab*/ab. (N/D 16)
(M/J 17)
5. Draw a DFA for augmented regular expression (a|b)* using direct method.
6. Explain in detail about left recursion and left factoring with example.
7. Construct predictive parser for
S->SS+|SS*
8. Discuss about context free grammars.
9. Give the predictive parser for (M/J 17) (N/D 18)
S->(L)|a
L->L,S|S
10. List out error recovery strategies and explain them.
SIM 2 1. Discuss in detail about ordering evaluation of attributes.
2. Construct the DAG for ((x+y)-((x+y)*(x-y)))+((x+y)*(x-y)) (M/J 17) (N/D
18)
7
DSEC/CSE/CS8602/III/VI
6. Compare static versus dynamic memory allocation.
7. Give the structure of action record. (M/J 19)
3. Explain in detail about data flow schemas on basic blocks. (M/J 17) (N/D 18)
5. Discuss in detail about how to find local common sub expression. (N/D 16)
Submission Details:
Prepared by Verified By
Mrs. S.FRANCIS SHAMILI Mrs.S.R.SOWMIYA
Approved by
PRINCIPAL
8
DSEC/CSE/CS8602/III/VI