This document contains information about a compiler design course including the instructor's contact details, class schedules, grading breakdown, attendance policies, prerequisite knowledge, recommended textbooks, an overview of what will be covered in the course, and brief introductions and explanations of the main stages of compilation: lexical analysis, parsing, semantic analysis, optimization, and code generation.
3. Theory Class Schedule:
Section 01: (UB30503)
Sunday, Monday
11.00 am - 12.20 pm
Section 02: (UB30501)
Sunday, Monday
08.00 am - 9.20 am
Lab Class Schedule:
Section 01: (UB40203)
NUM, MAZ
Monday, 08:00 am - 10:50 am
Section 02: (UB40203)
MAA, MKR
Thursday, 08:00 am-10:50 am 09/16/15 3
4. 35% - Final Examination
25% - LAB performance
20% - MID Examination
8% - Assignment & Surprise Quizzes
7% - Declared Quizzes
5% - Attendance
No students will be allowed to sit for
final examination if he/she has less
than 70% attendance in LAB Class and
less than 75% attendance in Theory
Class
09/16/15 4
5. There will be surprise quizzes, given at the start of a lecture,
during any lecture.
NO LATE or MAKEUP SURPRISE QUIZZES, under any
circumstances whatsoever.
Surprise quizzes are completely individual efforts.
Your best strategy is to play it safe – attend every lecture.
Surprise Quizzes
09/16/15 5
6. Assignments need to be hand-written. I will not accept typed
up solutions.
Assignments are completely individual efforts.
If two written solutions are the same or similar, both will be
penalized (100% penalty for the entire assignment).
If a written solution is similar or same as an online or other
solution resource, you will be penalized (100% penalty for
the entire assignment).
Assignments
09/16/15 6
7. If you follow these 4 simple rules during the class, you'll make
sure that you do well in the course:
1. Attend every Theory and LAB classes.
2. Read the course material (textbook sections assigned + slides).
3. Submit everything (Assignments, Quizzes, Exams) on time -
don't be late.
4. Don't cheat.
Playing it safe in
CSE-420
09/16/15 7
8. Two Quizzes
Several Surprise Quizzes
If you fail to attend any exam you will get 0 (zero) on
that exam.
No makeup exams unless with documented medical
emergency.
Quizzes and Exams
09/16/15 8
9. Strong programming
background in C, C++ or
Java
Some background on
Automata Theory (NFA,
DFA, CFG) is
recommended…… ……not
mandatory
Assembly Language
Programming and
Machine Architecture
Pre-requisite
Knowledge
09/16/15 9
12. Programming problems are easier to solve in high-level
languages
Languages closer to the level of the problem domain, e.g.,
SmallTalk: OO programming
JavaScript: Web pages
Solutions are usually more efficient (faster, smaller)
when written in machine language
Language that reflects to the cycle-by-cycle working of a processor
Compilers are the bridges:
Tools to translate programs written in high-level languages to efficient
executable code
What is a compiler?
09/16/15 12
14. 1954 IBM develops the 704
Successor to the 701
“Speedcoding”
FORTRAN I
Introduction To Compilers
09/16/15 14
15. The first compiler
Huge impact on computer science
Led to an enormous body of theoretical work
Modern compilers preserve the outline of FORTRAN I
Introduction To Compilers
09/16/15 15
17. First step: recognize words.
Smallest unit above letters
This is a sentence
Introduction To Compilers
09/16/15 17
18. ist his ase nte nce
Introduction To Compilers
09/16/15 18
19. Lexical analysis divides program text into
“words” or “tokens”
if x == y then z = 1; else z = 2;
Introduction To Compilers
09/16/15 19
20. Lexical analysis divides program text into
“words” or “tokens”
if x == y then z = 1; else z = 2;
Introduction To Compilers
09/16/15 20
21. Second Step: Once words are understood, the
next step is to understand sentence structure
Parsing = Diagramming Sentences
The diagram is a tree
Introduction To Compilers
09/16/15 21
22. This line is a longer sentence
Introduction To Compilers
09/16/15 22
23. if x == y then z = 1; else z = 2;
Introduction To Compilers
09/16/15 23
24. Third Step:
Once sentence structure is understood, we can
try to understand “meaning”
This is hard!
Compilers perform limited semantic analysis to
catch inconsistencies
Introduction To Compilers
09/16/15 24
25. Programming
languages define strict
rules to avoid such
ambiguities
Introduction To Compilers
{
int Jack = 3;
{
int Jack = 4;
cout << Jack;
}
}
{
int Jack = 3;
{
int Jack = 4;
cout << Jack;
}
}
09/16/15 25
26. Compilers perform many semantic checks
besides variable bindings
Example:
Jack left her homework at home.
A “type mismatch” between her and Jack;
we know they are different people
Introduction To Compilers
09/16/15 26
27. Optimization has no strong counterpart in
English
But a little bit like editing
X = Y * 0 is the same as X = 0
Automatically modify programs so that they
Run faster
Use less memory
Introduction To Compilers
09/16/15 27
28. Produces assembly code (usually)
A translation into another language
Analogous to human translation
Introduction To Compilers
09/16/15 28