SRM UNIVERSITY FACULTY OF ENGINEERING AND ...

74 downloads 132 Views 52KB Size Report
Principles of Compiler Design. Semester. : VI ... Unit I & II. 2 periods. 2. 8/03/2012. Cycle Test - II. Unit III & IV ... To analyze and be able to design a compiler.
SRM UNIVERSITY FACULTY OF ENGINEERING AND TECHNOLOGY SCHOOL OF COMPUTER SCIENCE AND ENGINEERING DEPARTMENT OF CSE COURSE PLAN Course Code : CS0352 Course Title : Principles of Compiler Design Semester : VI Course Time : Jan – April 2011 III YEAR SE ‘A’ Section Day order Hour Timing Day 1 ----Day 2 3 10.35 – 11.25 Day 3 1,4 8.45-9.35,11.25-12.15 Day 4 ----Day 5 5 1.30-2.20 Location : Tech Park Faculty Details Sec. Name A

Mrs.R.JEYA

Office TECH PARK (806A)

Office hour Monday, Thu & Fri (AN)

Mail id [email protected]

Required Text Books: 1. Alfred V. Aho, Ravi Sethi & Jeffrey. D. Ullman, “Compilers Principles, Techniques & Tools”,Pearson Education, third edition, 2007. 2. D.M.Dhamdhere, "System Programming and Operating Systems", 2nd Edition., Tata Mcgraw Hill,1995 Web resources http://lambda.uta.edu/cse5317/notes/notes.html www.cs.bilkent.edu.tr/~ilyas/courses/cs416/ Prerequisite

:

CS0355 – Theory of Computation

Objectives To understand, design and implement a lexical analyzer. To understand, design and implement a parser. To understand, design code generation schemes. To understand optimization of codes and runtime environment. Assessment Details Cycle Tet – I Surprise Test – I Cycle Test – II Model Exam Attendance

: 10 Marks : 5 Marks : 10 Marks : 20 Marks : 5 Marks

Test Schedule S.No. 1 2 3

DATE 2/02/2012 8/03/2012 12/04/2012

TEST Cycle Test - I Cycle Test - II Model Exam

TOPICS Unit I & II Unit III & IV All 5 units

DURATION 2 periods 2 periods 3 Hrs

Outcomes Students who have successfully completed this course will have full understanding of the following concepts Course outcome Program outcome To learn * The design and develop a comprehensive Compiler for a given language

To analyze and be able to design a compiler To implement various parsing, conversion, optimization and code generation algorithms for the design of a compiler

Detailed Session Plan UNIT I INTRODUCTION TO COMPILING 12 Compilers – Analysis of the source program – Phases of a compiler – Cousins of the Compiler – Grouping of Phases – Compiler construction tools – Lexical Analysis – Role of Lexical Analyzer – Input Buffering – Specification of Tokens. Introduction to Translators, Compiling, Discussion 1 50 1,2 BB Analysis of source program Phases of Compiler Illustration of Illustration by examples 2 50 1,2 BB compiling process by example Cousins of compiler , Compiler Test 3 50 1 BB construction tools Lexical analysis, Strings, operations on Quiz 4 50 1 BB strings, Tokens, lexemes, Lexical analyzer generator, design aspects Quiz 5 50 1 BB Input buffering, Specification of tokens Quiz 6 50 1 BB Grammars and Languages, Types of Problem solving, 7 50 1 BB grammars surprise test Finite State Automata, DFA,NDFA Problem solving, 8 50 1 BB surprise test Regular Expression to NDFA, Problem solving 9 50 1 BB Thompson’s construction Problem solving 10 Minimization of DFA 50 1 BB Problems on Regular exp. To DFA Problem solving, 11 50 1 BB Assignment Problems on Regular exp. To DFA Problem solving, 12 50 1 BB surprise test UNIT II SYNTAX ANALYSIS 12 Role of the parser –Writing Grammars –Context-Free Grammars – Top Down parsing – Recursive Descent Parsing – Predictive Parsing – Bottom-up parsing – Shift Reduce Parsing – Operator Precedent Parsing – LR Parsers – SLR Parser – Canonical LR Parser – LALR Parser. Introduction to Parsing, Top down and Quiz 13 50 1,2 BB Bottom up Group discussion

14 15 16 17 18 19 20

Context Free Grammars, Ambiguity in grammars, examples Shift Reduce Parsing Operator Precedence Parsing algorithm Precedence Matrix and Precedence functions, Boolean matrices Problems in Top down parsing: Left Recursion, Backtracking FIRST and FOLLOW procedures Recursive descent parsing

23

Predictive parsing, Parsing table construction Simple LR Parsing, LR(0) items, parsing table generation Canonical LR parsing

24

Look Ahead LR parsing,

21 22

Quiz Group discussion Quiz

50

1,2

BB

50

1

BB

50

1

BB

Surprise Test

50

1

BB

Group discussion

50

1

BB

50

1

BB

Assignment

50

1

BB

Brain storming

50

1

BB

Brain storming

50

1

BB

Brain storming

50

1

BB

Brain storming

50

1

BB

Brain storming

Quiz

UNIT III INTERMEDIATE CODE GENERATION 12 Intermediate languages – Declarations – Assignment Statements – Boolean Expressions – Case Statements – Back patching – Procedure calls. Intermediate Codes- Syntax Group discussion 25 tree,quadruple,triple,3Address 50 1 BB Assignment code,prefix,postfix Syntax-directed translation: SyntaxGroup discussion 26 directed definitions, synthesized and 50 1 BB Quiz inherited attributes Translation of assignment statements Group discussion 27 50 1 BB Assignment Illustration of translation on assignment Group discussion 28 50 1 BB statements Assignment Translation of Boolean expressions, Group discussion, 29 50 1 BB Surprise test Translation of control flow statements Group discussion, 30 50 1 BB Surprise test 31

Backpatching

32

Translation of Declaration

33

Translation of Procedure calls

34 35 36

S-attributed definition - L-attributed definition Intermediate languages – illustration with more examples Translation of Boolean expressions with examples

Group discussion

50

1

BB

50

1

BB

50

1

BB

50

1

BB

50

1

BB

Group discussion

50

1

BB

Group discussion

Group discussion Quiz Group discussion Group discussion

UNIT IV CODE GENERATION 10 Issues in the design of code generator – The target machine – Runtime Storage management – Basic Blocks and Flow Graphs – Next-use Information – A simple Code generator – DAG representation of Basic Blocks – Peephole Optimization.. 37 Code Generator – issues, target machine 50 1 BB Group discussion 38 A simple Code generator, design aspects 50 1 BB Group discussion 39 Code generator algorithm, with examples 50 1 BB Group discussion Run time environment -Source language 40 50 1 BB Group discussion issues, activation record Basic blocks and flow graphs Surprise test 41 50 1 BB Group discussion Next use information 42 50 1 BB Group discussion DAG representation of basic blocks 43 50 1 BB Assignment 44 Peephole optimization 50 1 BB Group discussion 45 Discussion on code generation issues 50 1 BB Group discussion 46 Discussion on runtime environment issues 50 1 BB Group discussion UNIT V CODE OPTIMIZATION AND RUN TIME ENVIRONMENTS 9+5 Introduction– Principal Sources of Optimization – Optimization of basic Blocks – Introduction to Global Data Flow Analysis – Runtime Environments – Source Language issues – Storage Organization – Storage Allocation strategies – Access to non-local names – Parameter Passing. Sessi on No. 47 48 49 50 51 52 53

Topics to be covered Code Optimization- Local optimization techniques Optimization of basic blocks, examples Loop optimization – Frequency reduction with examples Loop optimization – Strength reduction with examples, index variable elimination Global data flow analysis Storage organization –Storage allocation strategies Access to non-local names - Parameter passing Symbol tables- data structures used

54 55 56 57 58

Revision – Regular expr. To DFA Revision – FIRST , FOLLOW Revision – Top down Parsing techniques Revision – Bottom up Parsing techniques

Time (min)

Ref

Teaching Method

50

1,2

BB

50

1,2

BB

50

1

BB

50

1

BB

50

1

BB

50

1

BB

50

1

BB

50

1,2

BB

50

1,2

BB

50

1,2

BB

50

1,2

BB

50

1,2

BB

Testing Method Group discussion Quiz Group discussion Group discussion Group discussion Group discussion Quiz, Assignment Quiz, Assignment Assignment/ practical Group discussion Group discussion Group discussion Group discussion

59 60

Revision – Translation of expressions Revision – Code optimization and Generation BB - Blackboard

50

1,2

BB

50

1,2

BB

Group discussion Group discussion

Suggest Documents