100% found this document useful (1 vote)
296 views6 pages

COSC - 3104 - Compiler Construction, 16-Weeks Plan Course Outline

This document provides information about a Compiler Construction theory class taught by Safdar Hussain at KFUEIT. The course aims to teach students basic compiler techniques through syntax-directed translation of programming languages into executable code. It will cover topics like lexical analysis, parsing, semantic analysis, code generation, and optimization. The class is scheduled over 15 weeks and will use lectures, presentations, assignments, quizzes and case studies. Methods of evaluation include midterm and final exams.

Uploaded by

ab2478037
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
100% found this document useful (1 vote)
296 views6 pages

COSC - 3104 - Compiler Construction, 16-Weeks Plan Course Outline

This document provides information about a Compiler Construction theory class taught by Safdar Hussain at KFUEIT. The course aims to teach students basic compiler techniques through syntax-directed translation of programming languages into executable code. It will cover topics like lexical analysis, parsing, semantic analysis, code generation, and optimization. The class is scheduled over 15 weeks and will use lectures, presentations, assignments, quizzes and case studies. Methods of evaluation include midterm and final exams.

Uploaded by

ab2478037
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/ 6

Compiler Construction

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

Department of Computer Science (KFUEIT)


Safdar Hussain Lecturer Dept. CS

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.

Learning Outcomes 1. Understand the structure of Compilers


2. Understand the basic techniques used in Compiler
Construction such as Lexical Analysis, top-down, bottom-
On successful completion
up parsing, context-sensitive analysis and intermediate
of this course, student code generation
should be able to 3. Understand the basic data structures used in compiler
construction such as abstract syntax trees, symbol tables,
three-address code and stack machines
4. Design and implement a compiler using a software
engineering approach
5. Use generators (e.g. Lex and Yacc)

Course Contents Introduction to Compilers, Lexical Analysis, Syntax Analysis, Parsers


Implementation, Semantic Analysis, Intermediate Representation,
Code Generation, Code Optimization, Error Detection and
Recovery, Error Repair, Compiler Implementation, Compiler Design
Options and examples: C, C++, Java and YACC Compilers

METHODS OF TEACHING:

 Lectures
 Presentations
 Assignments
 Group Discussions
 Quizzes
 Case Studies
 Self-Learning

Dept. of CS (KFUEIT) Page 2


Safdar Hussain Lecturer Dept. CS

THEORY CLASS SCHEDULE


Lectures Breakdown
Week# Lecture# Description
Chapter#1
 Introduction to Language Processors (Translator)
Lecture 1  Introduction to Compiler, Cousins of Compiler
 Compilation, Model of Compilation
Week 1  Analysis Task for Compilation
(Introduction)
Chapter#1
 Symbol Table, Error Handler
Lecture 2
 Synthesis Task for Compilation
 Compiler Construction Tools

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

Dept. of CS (KFUEIT) Page 3


Safdar Hussain Lecturer Dept. CS

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

Dept. of CS (KFUEIT) Page 4


Safdar Hussain Lecturer Dept. CS

dependency graphs for Parse Tree, L-Attributed definitions

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

TEXT BOOK (s):


– Alfred V. Aho, Ravi Sethi and Jeffry D. Ulman, “Compilers, Principles, Techniques
and Tools”, Addison-Wesley, Second Edition, 2006, (ISBN: 0-201-10088-6).

REFERENCE BOOK (s):

– D. Grune, H. E. Bal, C.J. H. Jacobs, K. G. Langendoen, John Wiley, “Modern Compiler


Design”, Second Edition, Springer, New York, 2012.
– A. W. Appel, M. Ginsburg, “Modern Compiler Implementation in C”, Cambridge
University Press, 2002.

Dept. of CS (KFUEIT) Page 5


Safdar Hussain Lecturer Dept. CS

IMPORTANT:

Office Help Hours On demand (any time)

Grading Evaluation by Assignments, Presentations, quizzes.

Problem Session On demand

Student Evaluation Criteria (0%) Attendance

(4%) Workshops, Assignments, Case Study

(4%) Surprise Tests/Sudden Tests, Quizzes

(12%) Project Implementation

(30%) Mid Term Paper (Closed Book, Closed Notes)

(50%) Final Term Paper(Closed Book, Closed Notes)

Total

Student Responsibilities  Attendance must >=85


 Due respect to Instructor
 Due respect to fellows
 Due intension to Subject
 Cooperation in Class
Non-Ethical behavior will lead to 0% award

Course Instructor Safdar Hussain

Approved By (HoD) Dr. Hafeez-ur-Rehman

Dean/Chairman/Program Coordinator Dr. Saleemullah

Dept. of CS (KFUEIT) Page 6

You might also like