Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 12

1

CHAPTER 0
 COURSE OBJECTIVES:
 Upon completion of this course, students will have gained knowledge of
compiler design and construction concepts and to:
 Introduce the major concept areas of language translation and compiler
design.
 Understand the phases of the compilation process and be able to describe
the purpose and implementation approach of each phase.
 Know how to use compiler construction tools, such as generators of
scanners and parsers
 Be able to define LL(1), LR(1), and SLR(1) grammars with parsing
CON’T
2

 Be familiar with compiler analysis and optimization techniques


 Design a compiler for a simple programming language; and Implement
a compiler based on its design.
Course Goals or Learning Outcome
3

 By the end of this course, students will be able to:


 Implementing a small compiler using modern compiler writing tools
 Providing the student with skills and knowledge (such as lexical
analysis and parsing) which are applicable to a broad range of
computer science application areas (such as text editors, information
retrieval, etc...)
Prerequisites:
4

 Formal Language and Automata Theory


Text Books
5

 Texts Books:
 T1: Alfred Aho, Ravi Sethi, V.Jeffery Ullman D. “COMPILERS
PRINCIPLES, TECHINQUES AND TOOLS “, Addison- Wesley, 1988.
 Compilers: Principles, techniques and tools by Alfred V. Aho, Ravi
Sethi, Jeffrey D. Ullman
 Reference Books:
 Allen Holub l. “Compiler Design in C”, Prentice Hall of India. 1990
 Charles N.Fischer Richard J.Leblanc, “Crafting a compiler with C”,
Benjamin Cummings,1991
 Compiler construction : Principles and practice; Kenneth C.Louden
Summary of Teaching Learning Methods:
6

 The learning–teaching methodology will be student-centered with


appropriate guidance of instructor/s during the students’ activities .
 There will be Lecture, Demonstrations, and Tutorials, Reading
assignments, Group Discussions and Lab work.
Summary of Assessment Methods:
7

 Evaluation will carry out based on relevant continuous assessments


(class assessments, assignments and laboratory works) and
significantly scheduled and designed mid and final examinations.
Academic dishonesty
8

 Homework and project deadlines will be hard. Late homework will be


accepted with a 10% reduction in grade for each class period they are late by.
 However, once a homework assignment is discussed in class or the solution
is posted, submissions will no longer be accepted.
 All assignments must be turned in before the start of class on the due date.
 It is mandatory to attend all classes such as lecture class, laboratory sessions,
tutorials and seminars.
 However, with distinct circumstance up to 80% will be entertained.
 It is mandatory to pass 50% of the lab exam, in order to be eligible for the
final exam.
Con’t…
9

 Plagiarism will cause not only automatic course dismissal but also
academic discipline based on the rules and regulations of the
university.
 If someone is caught while cheating during final examination, his/her
grade will automatically be ‘F’.
 However, other assessments are evaluated as ‘0’. If someone misses
any assessments with a valid justification, he/she has a right to sit for
makeup exam.
Course outline
10
 1. Introduction  Construction and simulation of NFA and DFA
 Analysis and synthesis in a compilation  Conversion from RE – NFA –DFA
 Various phases in a compilation  Lex scanner generator
 Grouping of phases  3. Syntax analysis and Yacc
 Major data and structures in a compiler  Role of a parser
 Compiler construction tools  Context Free Grammar

 2. Lexical analysis and Lex  Derivation, parse tree, ambiguity, left recursion,

 Token, pattern, lexeme left factoring


 Syntax analysis
 Attributes of a token
 Syntax error handling
 Errors
 Top down parsing
 Specification of tokens using regular expressions
 Recursive decent parsing
 Regular expression for programming language
tokens  Non recursive predictive parsing
 Construction of predictive parsing table
 Recognizing tokens using transition diagrams
 LL(1) grammars
 Design of lexical analyzer
 Error recovery in predictive parsing
Con’t…
11

 Bottom up parsing  Specifications of a type checker


 LR(k) parsing  Equivalence of types
 Shift reduce parsing  Type conversion
 Construction of SLR parsing table  6. Intermediate code generation
 Canonical LR parsing  Intermediate languages

 Yacc parser generator  Types of three address statements

 4. Syntax directed translation  Syntax directed translation into three address

 Syntax directed definitions code


 Evaluation order  7. Code generation
 Classes of non-circular attributed grammars  Issues in the design of a code generator

 S-attributed grammars  A simple code generation algorithm

 L-attributed grammars  Memory management

 Instruction selection
 5. Type checking
 Type systems  Register allocation
?
12 Thank You

You might also like