0% found this document useful (0 votes)
71 views9 pages

Course Plan: DSEC/CSE/CS8602/III/VI

The document provides a course plan for the course "Compiler Design" (CS8602). It includes 5 units covering topics such as lexical analysis, syntax analysis, intermediate code generation, runtime environment and code optimization. The course is taught over 60 periods through methods like lectures and presentations. The objectives are to understand compiler phases and design lexical and syntax analyzers. Students will apply parsing algorithms, learn intermediate languages, and optimization techniques. Reference books and online resources are also provided.

Uploaded by

Mohana Subbu
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)
71 views9 pages

Course Plan: DSEC/CSE/CS8602/III/VI

The document provides a course plan for the course "Compiler Design" (CS8602). It includes 5 units covering topics such as lexical analysis, syntax analysis, intermediate code generation, runtime environment and code optimization. The course is taught over 60 periods through methods like lectures and presentations. The objectives are to understand compiler phases and design lexical and syntax analyzers. Students will apply parsing algorithms, learn intermediate languages, and optimization techniques. Reference books and online resources are also provided.

Uploaded by

Mohana Subbu
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/ 9

DSEC/CSE/CS8602/III/VI

COURSE PLAN

Name of the Faculty Mrs. S. FRANCIS SHAMILI


Designation/Department AP/CSE
Course Code/Name CS8602 / COMPILER DESIGN
Year/Section/Department III/C/CSE
Credits Details L:3 T:0 P:0 C:4
Total Contact Hours Required 60

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:

 To understand the different phases of compiler.


 To design a lexical analyzer for sample language.
 To apply different parsing algorithms to develop parsers for a given grammar.
 To understand syntax directed translation and run time environment.
 To learn to implement code optimization techniques and simple code generator.
 To design and implement a scanner and parser using LEX and YACC tools.
Text Book:

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/

Online Mode of Study (if Any):

NPTEL details can be listed.

 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:

Topic Topic Reference Page Mode of Number Cumulative


Number Detail Number teaching of Periods Period
Required
UNIT – I INTRODUCTION TO COMPILERS 12
Structure of a compiler T1 4-12 BB 1 1
1
Lexical Analysis – Role of
2 lexical analyzer T1 109-113 BB 1 2

Input Buffering R1 115-116 BB 1 3


3
Specification of Tokens T1 116-124 BB 1 4
4
Recognition of Tokens T1 125-134 BB 1 5
5
Lex R2 110-120 BB 2 7
6
Finite Automata T1 146-149 PPT 1 8
7
Regular Expressions to
T1 152-163 BB 2 10
8 Automata
Minimizing DFA. W4 PPT 2 12
9
Outcome of Unit I:
At the end of unit, Students should be able to
 Understand the different phases of compiler.
 Design a lexical analyzer for sample language.
 Convert regular expressions to Automata.

UNIT – II SYNTAX ANALYSIS 12


10 Role of Parser – Grammars T1 192-193 BB 1 13

11 Error Handling T1 194-195 BB 1 14


Context free grammars –
12 R3 164-167 BB 1 15
Writing a grammar
Top Down Parsing
General Strategies Recursive 217-220
13 T1 BB 1 16
Descent Parser

14 Predictive Parser 220-221 BB 1


T1 17

15 LL(1) Parser T1 222-228 BB 1 18

16 Shift Reduce Parser 236-238 PPT 1 19

17 LR Parser T1 241-252 BB 1 20

LR(0) Item construction of SLR


18 259-265 1
Parsing Table T1 BB 21

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

27 Types and Declarations R4 211-214 BB 1 33


Translation of
T1 378-383 PPT 2 35
28 Expressions
29 Type checking T1 386-395 BB 1 36
Outcome of Unit III:
At the end of unit, Students should be able to
 Understand syntax directed translation and code generation.
 Execute various type checking mechanisms.
 Understand Intermediate Languages
UNIT – IV RUNTIME ENVIRONMENT AND CODE GENERATION 12
Runtime Environment T1 427-428 BB 1 37
30
Code generation T1 428-429 BB 2 39
31
Storage
W2 BB 1 40
32 organization
Stack allocation Space T1 430-438 BB 1 41
33
Access to Non local Data on the
T1 441-448 BB 2 43
34 stack
Heap management T1 452-460 BB 2 45
35
Issues in Code Generation T1 506-511 BB 1 46
36
Design of a simple code T1
37 542-547 PPT 2 48
generator
4
DSEC/CSE/CS8602/III/VI
Outcome of Unit IV:
At the end of unit, Students should be able to
 Understand storage organization and stack allocation space
 Design a simple code generator.

UNIT – V CODE OPTIMIZATION 12


38 Code optimization 533-539 BB 1 49
T1
39 Principal Sources of 584- 592 PPT 2 51
Optimization T1

40 Peep hole optimization R5 352-357 BB 2 53

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.

Course Outcome Vs Program Outcome Mapping:

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

Content Beyond Syllabus:

 Implementation of LEX Tool


 Implementation of YAAC Tool 5
DSEC/CSE/CS8602/III/VI

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

Batch 2 814319104019-39 18 Seminar 2. Finite automata


3. Context free grammar.
1. Working of LEX tool

Batch 3 814319104040-60 17 PPT 2. Shift Reduce parser

3. Introduction to LALR parser

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.

1. Intermediate languages : Syntax


tree, three address code.
Batch 2 814319104019-39 18 PPT 2. Stack allocation space
3. Heap management.

1. Explain in detail about


Translation of expressions and
Batch 3 814319104040-60 17 Written type checking.
2. D=(a-b)*(a-c)+(a-c) apply code
generation algorithm to generate
code sequence for the three address
code.
3. Explain in detail about various
issues in code generation.
ASSIGNMENT III
1. Principle sources of code
Batch 1 814319104001-18 18 PPT optimization
2. Peep hole optimization
3. Implementation of DAG

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)

3. What is a type conversion? Explain in detail about two types of type


conversion. (M/J 19)
4. State the rules for type checking with example.

5. Discuss in detail about SDD (M/J 19)

7
DSEC/CSE/CS8602/III/VI
6. Compare static versus dynamic memory allocation.
7. Give the structure of action record. (M/J 19)

8. Discuss in detail about stack allocation of memory . (M/J 19)


9. Compare stack and heap allocation of memory with example.
10. Explain in detail about various issues in code generation.
SIM 3
1. Explain briefly about the principle sources of optimization. (M/J 17)

2. Demonstrate the optimization of basic blocks with an example. (N/D 16)

3. Explain in detail about data flow schemas on basic blocks. (M/J 17) (N/D 18)

4. Analyze the peephole optimization with suitable example. (N/D 18)

5. Discuss in detail about how to find local common sub expression. (N/D 16)

6. Discuss in detail about the use of Algebraic Identities. (M/J 17)

7. Give an example to identify dead code in the DAG

8. Summarize the data flow analysis in detail. (M/J 17)

9. Formulate the steps to identify the loops in the basic block.

10. Describe efficient data flow algorithm in detail.

Submission Details:

Phase 1(Before AT 1) Phase 2 (Before AT 2) Phase 3 (Before MODEL)


Assignment 1 SIM 1 Assignment2 SIM 2 Assignment 3 SIM 3

Google Class Code Details:


III CSE C : 6m2w5hj

Prepared by Verified By
Mrs. S.FRANCIS SHAMILI Mrs.S.R.SOWMIYA

(AP / CSE) (HOD/CSE)

Approved by
PRINCIPAL

8
DSEC/CSE/CS8602/III/VI

You might also like