COSC - 3104 - Compiler Construction, 16-Weeks Plan Course Outline
COSC - 3104 - Compiler Construction, 16-Weeks Plan Course Outline
THEORY CLASS
Course Instructor:
Safdar Hussain
(Lecturer Dept. Computer Science)
[email protected]
[email protected]
Audience:
BSCS-7th (A,B & C), MCS-4th (A)
Fall, 2021
COURSE DESCRIPTION
Course Objectives To teach the students the basic techniques that underlie
the practice of Compiler Construction.
Course will introduce the theory and tools to perform
syntax-directed translation of a high-level programming
language into an executable code.
To train the students for multiple applications including
verification and program analysis.
In addition, the course will provide deeper insights into the
more advanced semantic aspects of the programming
languages.
METHODS OF TEACHING:
Lectures
Presentations
Assignments
Group Discussions
Quizzes
Case Studies
Self-Learning
Chapter#1
Challenges to build Compiler
Lecture 3
Knowledge required to build Compiler
Week 2 Compiler Architecture
(Introduction) Chapter#1
Lexical Analysis Notation, Tree Notation
Lecture 4
Compiler Phases (Brief look on all 6 phases)
Operations in each phase of Compiler
Quiz#1 (Tentative)
Chapter#2
Tokens vs Terminals, Tree Terminology, Grammars
Lecture 5
Week 3 Parse Tree, Derivation, Ambiguity, Associativity &
(A Simple Precedence, left-associative & right-associative grammars
Syntax- Syntax Statements
directed Chapter#2
translator) Syntax-Directed Translation (SDT), Postfix Notation
Lecture 6 Synthesized & Inherited Attributes, Infix to Postfix
Translation, Attributed Grammars
Depth-First Traversal, SDD, Translation Schemes
Chapter#3
Parsing Types (Top-down & Bottom-Up)
Week 4 Lecture 7 Recursive-descent parsing, Predictive Parsing
(A Simple Predictive Parser (pseudo code), Tracing input string using
Syntax- predictive parser
directed Chapter#3
translator) FIRST & FIRST Sets, Left Recursion, Left Factoring
Lecture 8
Translator for Simple Expressions, Adding a lexical Analyzer
Token Attributes, Instructions for stack manipulation
Chapter#3
Week 5 Interaction of Lexical Analyzer & Parser, Lexical Errors
(Lexical Lecture 9 Tokens, lexemes, patterns, attributes of tokens
Analysis) String & language operations, RE, Regular definitions,
Notational shorthands
Chapter#3
Lecture 10 Regular Definitions & Grammars, Extra operations of LA
Implementing Transition Diagrams
Chap#3
Lexical Analyzer Generator design, Lex, Flex, YACC
Lecture 11
Structure of Lex Programs, Lex predefined variables &
Week 6 functions
(Lexical
Analysis)
Quiz#2 (Tentative)
Chap#3
Lecture 12
NFA formal definition, RE to NFA (Thompson Algorithm)
Simulating the combined NFA, empty closure & move
Chap#3
Lecture 13 Subset Construction Algorithm, Simulating a DFA
Week 7 NFA to DFA Conversion (Thompson Algorithm)
(Lexical Chap#3
Analysis) RE to DFA conversion directly, nullable(), firstpos(),
Lecture 14
lastpos(), followpos(), DFA State Minimization, Time Space
Tradeoffs
Chap#4
Parser, Error Handling, Viable prefix property,
Week 8 Lecture 15
Error Recovery Strategies, Grammars, Derivation
(Syntax
Chomsky Hierarchy, Left Recursion & its Elimination
Analysis)
Chap#4
Lecture 16
Left Factoring, Predictive parsing, FIRST & FOLLOW Sets
Mid Term Exams
Chap#4
LL(1) Grammars, Predictive parsing variants & its program
Lecture 17
Error Recovery (Panic Mode, Phrase-level, Adding Error
Week 9 productions)
(Syntax
Chap#4
Analysis)
Bottom-up parsing, LR Methods (Left-to-right, Rightmost
Lecture 18
derivation), SLR, CLR, LALR,
Shift Reduce parsing, Operator-precedence parsing
Chap#4
Bottom-up parsing, LR Methods (Left-to-right, Rightmost
Lecture 19
Week 10 derivation), SLR, CLR, LALR,
(Syntax Shift Reduce parsing, Operator-precedence parsing
Analysis) Quiz#3 (Tentative)
Lecture 20 Chap#4
ANTLR, Yacc & Bison
Chap#5
Week 11 Lecture 21 Syntax-Directed Translation, Synthesized vs Inherited
(Syntax
attributes
Directed
Translation) Chap#5
Lecture 22
S-Attributed Definitions, Bottom-up Evaluation, Acyclic
Chap#5
Week 12 Lecture 23 Concrete & Abstract Syntax Trees, Generating Abstract
(Syntax Syntax Trees using YACC
Directed
Translation) Chap#5
Lecture 24
Eliminating Left Recursion from a Translation Scheme
Chap#6
Week 13 Lecture 25 Intermediate Code Generation, Static checking,
(Intermediate Variants of Syntax Trees, DAG (Directed Acyclic Graph)
Code Quiz#4 (Tentative)
Generation) Lecture 26 Chap#6
3-Address Code, Data Structures of 3-Address Code
Chap#6
Week 14 Lecture 27 Basic Blocks Construction, Flow Graphs, Optimization of
(Intermediate Basic Blocks, Remove Common Sub-expressions
Code Chap#6
Generation) Lecture 28 Copy propagation, Dead-Code Elimination, Code Motion,
Induction Variables and Reduction in Strength
Chap#8
Lecture 29 The Target Machine
Week 15 Instruction Selection & Register Allocation
(Code
Generation)
Chap#8
Lecture 30 Basic blocks and Flow Graphs
A Simple Code Generator
Chap#8
Week 16 Lecture 31 Peephole Optimization
(Code Instruction Selector Generator
Generation) Graph-coloring Register Allocator
Lecture 32
Final Term Exams
IMPORTANT:
Total