CS5102019 01
CS5102019 01
2019all 2018
ADMINISTRIVIA
Lecture 0
Welcome to CS510 Compiler Construction
Course Information
Grading Policy
Project
3
Contact Info. & Office Hours
• 4th Floor-Room 519
• Facebook Group
https://web.facebook.com/groups/ISSR.CS510.2019/
• ISSR-Forum
http://www.issr-forum.com/
• E-mail
[email protected]
• Section: Thursday 7-9 Dr. Zeinab Ezz
4
References
1. Watson, Desc,” A Practical Approach to Compiler Construction”,
Springer International Publishing AG 2017
2. Andrew, W. Appel, and P. Jens. "Modern compiler implementation in
Java." (2004).
3. Louden, Kenneth C. "Compiler construction." Cengage Learning
(1997).
4. Torczon, Linda, and Keith Cooper. Engineering A Compiler. Morgan
Kaufmann Publishers Inc., 2007.
Prof. Abdelaziz Khamis Lectures
Dr. Nermin Hamza Lectures
Dr. Waleed Arafa Lectures
5
Recommended Video Lectures
Washington University
Compiler Construction
by Perkins
https://www.youtube.com/watch?v=Kk22pqxy_VI
Stanford university
Compiler
by Alex Aiken
https://lagunita.stanford.edu/courses/Engineering/Compilers/Fall2014/about
Compiler Design
by Ravindrababu Ravula
https://www.youtube.com/watch?v=Qkwj65l_96I&list=PLEbnTDJUr_IcPtUXFy2b1sGRP
sLFMghhS
6
75 Final.
15 Mid-term(22 April). GRADES
Project
10 Projects Exam. MidTerm
10%
15%
Final
75%
Midterm exam:
April 22,
7:00PM – 8:30PM,
Location TBA
7
Project(1)
No. of Students in each team[3-6]
(For Exceptions Contact Me).
Language used: Use your favorite programming Language.
Project Deadline :28-4-2019.
Project Exam Start :29-4-2019.
8
Project(2)
• Automatic Generated Scanner Using Lex.
• Automatic Generated Scanner Using Yacc.
• Code By Hand for the Compiler of “ISSR” Language.
• The Specification File of ISSR Language available at :
https://web.facebook.com/groups/ISSR.CS510.2019/
9
Project(3)
Project Deadline :6-5-2018.
• Send to my Facebook Account
1. WinRAR file
1. Team names(txt file)
2. Lex File
3. Yacc File
4. Code by hand
5. exe or jar files for automatic generated Scanner
6. exe or jar files for automatic generated Parser
7. exe or jar files for code by hand compiler for the ISSR Language
10
Project(4)
Project Exam
Lex & Yacc Practical Exam(2 Marks).
Code by hand Project Practical Exam(8 Marks).
11
Introduction
Lecture 1
What is a compiler
C7 06
0000 Develop X=2
0002 A
Compiler
Program
13
What is a compiler
• A compiler is a program that takes as input a program written in one
language (the source language) and translates it into an equivalent program
in another language (the target language).
• Thesource language may be (C++, Java, or C#), and the target language is
usually assembly or machine code.
•A compiler also reports errors and warnings.
14
• Admiral Grace Murray Hopper Inventor
of A-0, COBOL
• The term “compiler.”
15
• Speed Coding
• Fortran I
http://www.columbia.edu/cu/computinghistory/backus.html
16
• 1954 IBM develops the 704 –Successor to the 701
17
* http://www.columbia.edu/cu/computinghistory/704.html
Compiler (Why?)
Machine Language
The instruction to move the number 2 to the location 0000.
C7 06 0000 0002
18
Compiler’s definition
A compiler is
a software translates programs in a source language into
target language.
Offline
Source
Program
Compiler
Target
Data Output
Program
19
What is a n Interpreter
• Unlikea compiler, an interpreter does not produce a target program. It
reads an executable program and produces the results
• Online
Program Data
Output
20
Hybrid Compilers
• Source program is compiled into an intermediate program, which is
later interpreted by an interpreter.
• For example, Java programs(*.java) are compiled into byte
code(*.class), which is later interpreted by the just-in-time compiler (a
virtual machine).
21
Phases of the Compiler
Source Front End ‘Middle End’ Back End Target
chars IR IR
Scan Select Instructions
tokens IR
Semantics Emit
IR IR
Machine Code