SlideShare a Scribd company logo
1 of 29
5/11/2021 Saeed Parsa 1
Compiler Design
Course Introduction
Saeed Parsa
Room 332,
School of Computer Engineering,
Iran University of Science & Technology
parsa@iust.ac.ir
Winter 2021
Who, when/where, and what?
• Who are we?
• Lecturer
• Saeed Parsa
• Associate Professor in IUST
• Research Area: Software Engineering, Software Testing,
Software Debugging, Reverse Engineering, etc.
• Email: parsa@iust.ac.ir
• More Information:
• http://parsa.iust.ac.ir/
• Slide Share
• https://www.slideshare.net/SaeedParsa
5/11/2021 Saeed Parsa 2
Who, when/where, and what?
• When/where will attend the class?
• Time: 09:00-10:30 on Saturday & Monday
• Class: Virtual (Hope to have physical class soon!)
• What will we read (textbook)?
• No textbook is required for the class.
• You may use the slides prepared for the course.
• However, you may find a textbook useful as a reference or to learn
more details of some of the ideas discussed in the course.
5/11/2021 Saeed Parsa 3
Who, when/where, and what?
• Suggested References:
• Language Implementation Patterns, by Terence Parr
• Compilers Principles, Techniques & tools, by Alfred V. Aho
5/11/2021 Saeed Parsa 4
2020 ACM A.M. Turing Award Laureates
• ACM Turing Award Honors Innovators Who Shaped the Foundations
of Programming Language Compilers and Algorithms
12 April 2021 Advanced compiler - Morteza Zakeri, Ph.D. Student 5
Alfred Vaino Aho Jeffrey David Ullman Dragon book
Teacher Assistants
• Four TAs:
• Danial Bazmandeh (Email: danibazi9@gmail.com)
• Seyyed Ali Ayati (Email: danibazi9@gmail.com)
• Mina Tahaei (Email: danibazi9@gmail.com)
• Danial Nafez (Email: danibazi9@gmail.com)
5/11/2021 Saeed Parsa 6
Class policies
• Exams to be done on the date given
• We have a quiz/midterm after each chapter
• There will be at least several homeworks & quizzes before the
last possible drop date.
• Class participation & attendance
• Attendance in the main class is required.
• The students whose number of absences are more than 6 session, have to
drop the course!
• Participation & being active in class will be encouraged.
5/11/2021 Saeed Parsa 7
Class policies
• The due dates are to be taken seriously and you should not expect them to be
extended.
• Homework to be graded should be turned on the specified due date.
• NO late programs or homework will be accepted FOR FULL CREDIT
without discussion with me prior to the due date.
• Allowing no late assignments would not give you much incentive to
continue to work on the assignment, which is a major source of learning in
this course.
5/11/2021 Saeed Parsa 8
Class policies
• Thus, I believe late assignments are better than no assignment.
• Late assignments will be penalized:
• 5% off the total possible points if turned in within the first 24-hour
period after the specified due date and time, and
• 5% per 24-hour period (or fraction of a day) (including weekends) after
that time, up to a week after the due date.
5/11/2021 Saeed Parsa 9
Class policies
• Any question
• You can communicate with me in Skype.
• Just search live:saeedparsa
5/11/2021 Saeed Parsa 10
Course Learning Objectives
1. Describe the various phases of a compiler
2. Use regular expressions & context free languages to define a language syntax.
3. Create a grammar for a simple context free language
4. Implement a lexical analyzer to recognize tokens defined by regular expressions
5. Implement a parser, using either top down (recursive descent) or bottom up (LR)
techniques
6. Generate working target language for simple programming constructs.
5/11/2021 Saeed Parsa 11
Course Learning Objectives
• This course examines the fundamental theory and practice of implementing
today's programming languages.
• The compiler course is an important component in the undergraduate
Computer Science curriculum.
5/11/2021 Saeed Parsa 12
Prerequisites
Automata Theory provides the base of the course on which several automated
tools can be designed to be used at various phases of a compiler.
Advances in computer architecture,
Machine code and assemblers,
Memory management and operating systems provide the compiler designer
large number of options to try out for efficient code generation.
Data structures.
5/11/2021 Saeed Parsa 13
Why Study Compilers?
• Compilers provide a bridge between applications and architectures.
• Compilers encapsulate techniques for reasoning about programs and their behavior.
• First major computer application.
• An opportunity to explore compiler techniques in both breadth and depth
Parallelization? Functional? Optimizations with more details.
• Compiler optimizations rely on both program analysis and transformation.
5/11/2021 Saeed Parsa 14
Why Study Compilers?
• Program analysis and transformation are useful in many related areas:
• Software engineering:
 program understanding / reverse engineering / debugging / Testing
 Run - time support and improvement
• Open problems Engineering effort:
 limits and issues Motivate research topics “Advanced Compiler
Techniques”.
5/11/2021 Saeed Parsa 15
Grading policy
• Five Programming Assignments
 (8% × 5 = 40%): (tentatively) out on weeks 1, 3, 5, 9, 12
• Three Midterms and Final exam
 (5% + 5% + 5% + 15% = 30%): around weeks 3, 8, 11 and 17
• One non-programming Assignment
 (5%)
• Final Project
 (20%) -- In groups of three
• Class Participation
 (5%) -- Both in-class & on canvas; helping your peers will be rewarded.
5/11/2021 Saeed Parsa 16
Course Layout
Being primarily targeted to a one-semester course for the undergraduate
students, the course will cover the following topics:
Week 1 Introduction
- Compilation steps
- How to install ANTLR
- Assignment 1: Install and use ANTLR.
5/11/2021 Saeed Parsa 17
Course Layout
Week 2 Lexical Analysis
- Input, output and body of the lexical analyzer.
- Regular expressions
- Assignment 2: Report on how to use REGX class.
Week 3 - Use ANTLR to develop a lexical analyzer.
- Assignment 3: Use ANTLR to develop a lexical analyzer.
- Solving examples.
- Assignment 1 deadline.
Week 4 - Solving examples.
- Midterm exam-1.
- Assignment 2 deadline.
5/11/2021 Saeed Parsa 18
Course Layout (Continued)
Week 5 Languages and Grammars
- Grammars and parse tress.
- Ambiguous grammars.
Week 6 - First and follow sets
- Use ANTLR to build parse trees.
- Use ANTLR to build parse tree for C# programs.
Week 7 Top-down parsers
- LL(1) parsers.
- LL(1) parsing tables.
5/11/2021 Saeed Parsa 19
Course Layout (Continued)
Week 8 Recursive Descent parsers
- How to develop recursive descent parsers.
- Using ANTLR to develop a recursive descent parser.
- Assignment 4: Use ANTLR to develop a recursive descent parser
- Assignment 3 deadline.
Week 9 Bottom-up parsers
- Bottom up parsing
- LR(1) Grammars
5/11/2021 Saeed Parsa 20
Course Layout (Continued)
Week 10 LR(1) parsers
- LR(1) states
- LR(1) parsing tables
Week 11 LALR(1) & SLR(1) parsers
- LALR(1) parsers.
- SLR(1) parsing tables.
5/11/2021 Saeed Parsa 21
Course Layout (Continued)
Week 12 Ambiguous grammars
- Ambiguous grammar tables.
- Assignment 4 deadline
Week 13 - Practical
- Midterm Exam 3
5/11/2021 Saeed Parsa 22
Why am I teaching this course?
• “If you don’t understand compilers, you can still write programs – you
can even be a competent programmer – but you can’t be a master.”
– Hal Abelson,
MIT
• “If you don’t know how compilers work, then you don’t know how
computers work. If you’re not 100% sure whether you know how
compilers work, then you don’t know how they work.”
– Steve Yegge
5/11/2021 Saeed Parsa 23
Why am I teaching this course?
• Development of tools for
- Reverse engineering
- Software testing
- Software quality assessment
- Source code analysis
Is based on compiler techniques.
5/11/2021 Saeed Parsa 24
How to increase your learning?
• Participate actively in class.
• This course is not meant to be a passive learning course, as it has
been shown that the best learning occurs when the learner is an
active participant, not a passive listener. Besides, classes are much
more enjoyable when the audience actively participates!
• Read the textbook.
• At least read the chapter as each new topic is covered in class.
Besides, you should not expect to gain all understanding of the
concepts from passively listening in the class periods alone.
5/11/2021 Saeed Parsa 25
How to increase your learning?
• Take an active role in your group projects.
• Ask your group members to explain concepts you do not clearly
understand, and share ideas among the group members. Meet
regularly with your group.
• Form an informal study group outside of class.
• Compare your notes from class, work together on group projects,
and discuss concepts you find unclear.
• Seek help if you start to feel lost, ASAP.
• Ask questions via chat room.
5/11/2021 Saeed Parsa 26
Prelude
Q: Who wrote the first compiler, when, and for what language?
A: Admiral Grace Murray Hopper in 1952
Q: What language did it compile?
A: A-0 (similar to 3-address code) for the UNIVAC I at Eckert-Mauchly Computer
Corporation
Q: What other interesting things did Admiral Hopper accomplish?
A: Helped develop COBOL for the UNIVAC
A: In 1969, awarded the first ever Computer Science “Man-of-
the-Year” Award from the Data Processing Management Association.
A: Rear Admiral in the Navy (highest rank for a woman)
A: In 1986, at 80, oldest active duty officer in the US.
A: In 1991, the National Medal of Technology (first woman to win)
Quote: “It's easier to ask forgiveness than it is to get permission.”
5/11/2021 Saeed Parsa 27
Phases of a Compiler
1. Lexical Analysis:
 Converts a sequence of characters into words, or tokens
2. Syntax Analysis:
 Converts a sequence of tokens into a parse tree
3. Semantic Analysis:
 Manipulates parse tree to verify symbol and type information
4. Intermediate Code Generation:
 Converts parse tree into a sequence of intermediate code instructions
5. Optimization:
 Manipulates intermediate code to produce a more efficient program
6. Final Code Generation:
 Translates intermediate code into final (machine/assembly) code
5/11/2021 Saeed Parsa 28
The place of IUST in the world
5/11/2021 Saeed Parsa 29
https://www.researchgate.net/publication/328099969_Software_Fault_Localisation_A_Systematic_Mapping_Study

More Related Content

Similar to 1. course introduction

Essentials for a Better ICT Student in Palestine
Essentials for a Better ICT Student in PalestineEssentials for a Better ICT Student in Palestine
Essentials for a Better ICT Student in PalestineJafar Hajeer
 
Programming in Java: Introduction
Programming in Java: IntroductionProgramming in Java: Introduction
Programming in Java: IntroductionMartin Chapman
 
Embedded Systems: Lecture 1: Course Overview
Embedded Systems: Lecture 1: Course OverviewEmbedded Systems: Lecture 1: Course Overview
Embedded Systems: Lecture 1: Course OverviewAhmed El-Arabawy
 
System software coursebreakup
System software coursebreakupSystem software coursebreakup
System software coursebreakupShruti Jain
 
EDUC 5405 G - Week 1
EDUC 5405 G - Week 1EDUC 5405 G - Week 1
EDUC 5405 G - Week 1Robert Power
 
EDUC5103G - Week 1 Class Slides
EDUC5103G - Week 1 Class SlidesEDUC5103G - Week 1 Class Slides
EDUC5103G - Week 1 Class SlidesRobert Power
 
Killer Online Design and Teaching Techniques
Killer Online Design and Teaching TechniquesKiller Online Design and Teaching Techniques
Killer Online Design and Teaching TechniquesRaymond Rose
 
2CPP01 - Intro to Module
2CPP01 - Intro to Module2CPP01 - Intro to Module
2CPP01 - Intro to ModuleMichael Heron
 
Designing Instructional Discussion Forums
Designing Instructional Discussion ForumsDesigning Instructional Discussion Forums
Designing Instructional Discussion ForumsChristine Gonnella
 
Stack Overflow slides Data Analytics
Stack Overflow slides Data Analytics Stack Overflow slides Data Analytics
Stack Overflow slides Data Analytics Rahul Thankachan
 
EDUC5405 Lesson 1 S20
EDUC5405 Lesson 1 S20EDUC5405 Lesson 1 S20
EDUC5405 Lesson 1 S20Robert Power
 
EDUC5405 Lesson 1 s21
EDUC5405 Lesson 1 s21EDUC5405 Lesson 1 s21
EDUC5405 Lesson 1 s21Robert Power
 
Introduction and administrative information (MS Word 97 format)
Introduction and administrative information (MS Word 97 format)Introduction and administrative information (MS Word 97 format)
Introduction and administrative information (MS Word 97 format)butest
 
Engl317 syllabus hybrid_waters
Engl317 syllabus hybrid_watersEngl317 syllabus hybrid_waters
Engl317 syllabus hybrid_waterskwaters23
 
Student Pipeline to Open Source Communities using HFOSS
Student Pipeline to Open Source Communities using HFOSSStudent Pipeline to Open Source Communities using HFOSS
Student Pipeline to Open Source Communities using HFOSSAll Things Open
 
Kowledge zoom michelle
Kowledge zoom michelleKowledge zoom michelle
Kowledge zoom michelleRoya Hosseini
 
Cengage Learning Webinar, Dev Studies, Using Technology in Texas' Integrated ...
Cengage Learning Webinar, Dev Studies, Using Technology in Texas' Integrated ...Cengage Learning Webinar, Dev Studies, Using Technology in Texas' Integrated ...
Cengage Learning Webinar, Dev Studies, Using Technology in Texas' Integrated ...Cengage Learning
 
JavaOne Tutorial Techniques for Getting More Kids, Especially Girls, Involved...
JavaOne Tutorial Techniques for Getting More Kids, Especially Girls, Involved...JavaOne Tutorial Techniques for Getting More Kids, Especially Girls, Involved...
JavaOne Tutorial Techniques for Getting More Kids, Especially Girls, Involved...Heather VanCura
 

Similar to 1. course introduction (20)

III-1ece.pdf
III-1ece.pdfIII-1ece.pdf
III-1ece.pdf
 
Essentials for a Better ICT Student in Palestine
Essentials for a Better ICT Student in PalestineEssentials for a Better ICT Student in Palestine
Essentials for a Better ICT Student in Palestine
 
Programming in Java: Introduction
Programming in Java: IntroductionProgramming in Java: Introduction
Programming in Java: Introduction
 
Embedded Systems: Lecture 1: Course Overview
Embedded Systems: Lecture 1: Course OverviewEmbedded Systems: Lecture 1: Course Overview
Embedded Systems: Lecture 1: Course Overview
 
System software coursebreakup
System software coursebreakupSystem software coursebreakup
System software coursebreakup
 
EDUC 5405 G - Week 1
EDUC 5405 G - Week 1EDUC 5405 G - Week 1
EDUC 5405 G - Week 1
 
EDUC5103G - Week 1 Class Slides
EDUC5103G - Week 1 Class SlidesEDUC5103G - Week 1 Class Slides
EDUC5103G - Week 1 Class Slides
 
Killer Online Design and Teaching Techniques
Killer Online Design and Teaching TechniquesKiller Online Design and Teaching Techniques
Killer Online Design and Teaching Techniques
 
2CPP01 - Intro to Module
2CPP01 - Intro to Module2CPP01 - Intro to Module
2CPP01 - Intro to Module
 
Designing Instructional Discussion Forums
Designing Instructional Discussion ForumsDesigning Instructional Discussion Forums
Designing Instructional Discussion Forums
 
Stack Overflow slides Data Analytics
Stack Overflow slides Data Analytics Stack Overflow slides Data Analytics
Stack Overflow slides Data Analytics
 
EDUC5405 Lesson 1 S20
EDUC5405 Lesson 1 S20EDUC5405 Lesson 1 S20
EDUC5405 Lesson 1 S20
 
EDUC5405 Lesson 1 s21
EDUC5405 Lesson 1 s21EDUC5405 Lesson 1 s21
EDUC5405 Lesson 1 s21
 
Introduction and administrative information (MS Word 97 format)
Introduction and administrative information (MS Word 97 format)Introduction and administrative information (MS Word 97 format)
Introduction and administrative information (MS Word 97 format)
 
Soft Eng 1st PPT
Soft Eng 1st PPTSoft Eng 1st PPT
Soft Eng 1st PPT
 
Engl317 syllabus hybrid_waters
Engl317 syllabus hybrid_watersEngl317 syllabus hybrid_waters
Engl317 syllabus hybrid_waters
 
Student Pipeline to Open Source Communities using HFOSS
Student Pipeline to Open Source Communities using HFOSSStudent Pipeline to Open Source Communities using HFOSS
Student Pipeline to Open Source Communities using HFOSS
 
Kowledge zoom michelle
Kowledge zoom michelleKowledge zoom michelle
Kowledge zoom michelle
 
Cengage Learning Webinar, Dev Studies, Using Technology in Texas' Integrated ...
Cengage Learning Webinar, Dev Studies, Using Technology in Texas' Integrated ...Cengage Learning Webinar, Dev Studies, Using Technology in Texas' Integrated ...
Cengage Learning Webinar, Dev Studies, Using Technology in Texas' Integrated ...
 
JavaOne Tutorial Techniques for Getting More Kids, Especially Girls, Involved...
JavaOne Tutorial Techniques for Getting More Kids, Especially Girls, Involved...JavaOne Tutorial Techniques for Getting More Kids, Especially Girls, Involved...
JavaOne Tutorial Techniques for Getting More Kids, Especially Girls, Involved...
 

More from Saeed Parsa

6 attributed grammars
6  attributed grammars6  attributed grammars
6 attributed grammarsSaeed Parsa
 
5 top-down-parsers
5  top-down-parsers 5  top-down-parsers
5 top-down-parsers Saeed Parsa
 
2. introduction to compiler
2. introduction to compiler2. introduction to compiler
2. introduction to compilerSaeed Parsa
 
4. languages and grammars
4. languages and grammars4. languages and grammars
4. languages and grammarsSaeed Parsa
 
3. Lexical analysis
3. Lexical analysis3. Lexical analysis
3. Lexical analysisSaeed Parsa
 

More from Saeed Parsa (6)

6 attributed grammars
6  attributed grammars6  attributed grammars
6 attributed grammars
 
5 top-down-parsers
5  top-down-parsers 5  top-down-parsers
5 top-down-parsers
 
2. introduction to compiler
2. introduction to compiler2. introduction to compiler
2. introduction to compiler
 
4. languages and grammars
4. languages and grammars4. languages and grammars
4. languages and grammars
 
3. Lexical analysis
3. Lexical analysis3. Lexical analysis
3. Lexical analysis
 
2. introduction
2. introduction2. introduction
2. introduction
 

Recently uploaded

Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...jaredbarbolino94
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...M56BOOKSTORE PRODUCT/SERVICE
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfadityarao40181
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfMahmoud M. Sallam
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxRaymartEstabillo3
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitolTechU
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentInMediaRes1
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerunnathinaik
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxJiesonDelaCerna
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 

Recently uploaded (20)

Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdf
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdf
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptx
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media Component
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developer
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptx
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 

1. course introduction

  • 1. 5/11/2021 Saeed Parsa 1 Compiler Design Course Introduction Saeed Parsa Room 332, School of Computer Engineering, Iran University of Science & Technology parsa@iust.ac.ir Winter 2021
  • 2. Who, when/where, and what? • Who are we? • Lecturer • Saeed Parsa • Associate Professor in IUST • Research Area: Software Engineering, Software Testing, Software Debugging, Reverse Engineering, etc. • Email: parsa@iust.ac.ir • More Information: • http://parsa.iust.ac.ir/ • Slide Share • https://www.slideshare.net/SaeedParsa 5/11/2021 Saeed Parsa 2
  • 3. Who, when/where, and what? • When/where will attend the class? • Time: 09:00-10:30 on Saturday & Monday • Class: Virtual (Hope to have physical class soon!) • What will we read (textbook)? • No textbook is required for the class. • You may use the slides prepared for the course. • However, you may find a textbook useful as a reference or to learn more details of some of the ideas discussed in the course. 5/11/2021 Saeed Parsa 3
  • 4. Who, when/where, and what? • Suggested References: • Language Implementation Patterns, by Terence Parr • Compilers Principles, Techniques & tools, by Alfred V. Aho 5/11/2021 Saeed Parsa 4
  • 5. 2020 ACM A.M. Turing Award Laureates • ACM Turing Award Honors Innovators Who Shaped the Foundations of Programming Language Compilers and Algorithms 12 April 2021 Advanced compiler - Morteza Zakeri, Ph.D. Student 5 Alfred Vaino Aho Jeffrey David Ullman Dragon book
  • 6. Teacher Assistants • Four TAs: • Danial Bazmandeh (Email: danibazi9@gmail.com) • Seyyed Ali Ayati (Email: danibazi9@gmail.com) • Mina Tahaei (Email: danibazi9@gmail.com) • Danial Nafez (Email: danibazi9@gmail.com) 5/11/2021 Saeed Parsa 6
  • 7. Class policies • Exams to be done on the date given • We have a quiz/midterm after each chapter • There will be at least several homeworks & quizzes before the last possible drop date. • Class participation & attendance • Attendance in the main class is required. • The students whose number of absences are more than 6 session, have to drop the course! • Participation & being active in class will be encouraged. 5/11/2021 Saeed Parsa 7
  • 8. Class policies • The due dates are to be taken seriously and you should not expect them to be extended. • Homework to be graded should be turned on the specified due date. • NO late programs or homework will be accepted FOR FULL CREDIT without discussion with me prior to the due date. • Allowing no late assignments would not give you much incentive to continue to work on the assignment, which is a major source of learning in this course. 5/11/2021 Saeed Parsa 8
  • 9. Class policies • Thus, I believe late assignments are better than no assignment. • Late assignments will be penalized: • 5% off the total possible points if turned in within the first 24-hour period after the specified due date and time, and • 5% per 24-hour period (or fraction of a day) (including weekends) after that time, up to a week after the due date. 5/11/2021 Saeed Parsa 9
  • 10. Class policies • Any question • You can communicate with me in Skype. • Just search live:saeedparsa 5/11/2021 Saeed Parsa 10
  • 11. Course Learning Objectives 1. Describe the various phases of a compiler 2. Use regular expressions & context free languages to define a language syntax. 3. Create a grammar for a simple context free language 4. Implement a lexical analyzer to recognize tokens defined by regular expressions 5. Implement a parser, using either top down (recursive descent) or bottom up (LR) techniques 6. Generate working target language for simple programming constructs. 5/11/2021 Saeed Parsa 11
  • 12. Course Learning Objectives • This course examines the fundamental theory and practice of implementing today's programming languages. • The compiler course is an important component in the undergraduate Computer Science curriculum. 5/11/2021 Saeed Parsa 12
  • 13. Prerequisites Automata Theory provides the base of the course on which several automated tools can be designed to be used at various phases of a compiler. Advances in computer architecture, Machine code and assemblers, Memory management and operating systems provide the compiler designer large number of options to try out for efficient code generation. Data structures. 5/11/2021 Saeed Parsa 13
  • 14. Why Study Compilers? • Compilers provide a bridge between applications and architectures. • Compilers encapsulate techniques for reasoning about programs and their behavior. • First major computer application. • An opportunity to explore compiler techniques in both breadth and depth Parallelization? Functional? Optimizations with more details. • Compiler optimizations rely on both program analysis and transformation. 5/11/2021 Saeed Parsa 14
  • 15. Why Study Compilers? • Program analysis and transformation are useful in many related areas: • Software engineering:  program understanding / reverse engineering / debugging / Testing  Run - time support and improvement • Open problems Engineering effort:  limits and issues Motivate research topics “Advanced Compiler Techniques”. 5/11/2021 Saeed Parsa 15
  • 16. Grading policy • Five Programming Assignments  (8% × 5 = 40%): (tentatively) out on weeks 1, 3, 5, 9, 12 • Three Midterms and Final exam  (5% + 5% + 5% + 15% = 30%): around weeks 3, 8, 11 and 17 • One non-programming Assignment  (5%) • Final Project  (20%) -- In groups of three • Class Participation  (5%) -- Both in-class & on canvas; helping your peers will be rewarded. 5/11/2021 Saeed Parsa 16
  • 17. Course Layout Being primarily targeted to a one-semester course for the undergraduate students, the course will cover the following topics: Week 1 Introduction - Compilation steps - How to install ANTLR - Assignment 1: Install and use ANTLR. 5/11/2021 Saeed Parsa 17
  • 18. Course Layout Week 2 Lexical Analysis - Input, output and body of the lexical analyzer. - Regular expressions - Assignment 2: Report on how to use REGX class. Week 3 - Use ANTLR to develop a lexical analyzer. - Assignment 3: Use ANTLR to develop a lexical analyzer. - Solving examples. - Assignment 1 deadline. Week 4 - Solving examples. - Midterm exam-1. - Assignment 2 deadline. 5/11/2021 Saeed Parsa 18
  • 19. Course Layout (Continued) Week 5 Languages and Grammars - Grammars and parse tress. - Ambiguous grammars. Week 6 - First and follow sets - Use ANTLR to build parse trees. - Use ANTLR to build parse tree for C# programs. Week 7 Top-down parsers - LL(1) parsers. - LL(1) parsing tables. 5/11/2021 Saeed Parsa 19
  • 20. Course Layout (Continued) Week 8 Recursive Descent parsers - How to develop recursive descent parsers. - Using ANTLR to develop a recursive descent parser. - Assignment 4: Use ANTLR to develop a recursive descent parser - Assignment 3 deadline. Week 9 Bottom-up parsers - Bottom up parsing - LR(1) Grammars 5/11/2021 Saeed Parsa 20
  • 21. Course Layout (Continued) Week 10 LR(1) parsers - LR(1) states - LR(1) parsing tables Week 11 LALR(1) & SLR(1) parsers - LALR(1) parsers. - SLR(1) parsing tables. 5/11/2021 Saeed Parsa 21
  • 22. Course Layout (Continued) Week 12 Ambiguous grammars - Ambiguous grammar tables. - Assignment 4 deadline Week 13 - Practical - Midterm Exam 3 5/11/2021 Saeed Parsa 22
  • 23. Why am I teaching this course? • “If you don’t understand compilers, you can still write programs – you can even be a competent programmer – but you can’t be a master.” – Hal Abelson, MIT • “If you don’t know how compilers work, then you don’t know how computers work. If you’re not 100% sure whether you know how compilers work, then you don’t know how they work.” – Steve Yegge 5/11/2021 Saeed Parsa 23
  • 24. Why am I teaching this course? • Development of tools for - Reverse engineering - Software testing - Software quality assessment - Source code analysis Is based on compiler techniques. 5/11/2021 Saeed Parsa 24
  • 25. How to increase your learning? • Participate actively in class. • This course is not meant to be a passive learning course, as it has been shown that the best learning occurs when the learner is an active participant, not a passive listener. Besides, classes are much more enjoyable when the audience actively participates! • Read the textbook. • At least read the chapter as each new topic is covered in class. Besides, you should not expect to gain all understanding of the concepts from passively listening in the class periods alone. 5/11/2021 Saeed Parsa 25
  • 26. How to increase your learning? • Take an active role in your group projects. • Ask your group members to explain concepts you do not clearly understand, and share ideas among the group members. Meet regularly with your group. • Form an informal study group outside of class. • Compare your notes from class, work together on group projects, and discuss concepts you find unclear. • Seek help if you start to feel lost, ASAP. • Ask questions via chat room. 5/11/2021 Saeed Parsa 26
  • 27. Prelude Q: Who wrote the first compiler, when, and for what language? A: Admiral Grace Murray Hopper in 1952 Q: What language did it compile? A: A-0 (similar to 3-address code) for the UNIVAC I at Eckert-Mauchly Computer Corporation Q: What other interesting things did Admiral Hopper accomplish? A: Helped develop COBOL for the UNIVAC A: In 1969, awarded the first ever Computer Science “Man-of- the-Year” Award from the Data Processing Management Association. A: Rear Admiral in the Navy (highest rank for a woman) A: In 1986, at 80, oldest active duty officer in the US. A: In 1991, the National Medal of Technology (first woman to win) Quote: “It's easier to ask forgiveness than it is to get permission.” 5/11/2021 Saeed Parsa 27
  • 28. Phases of a Compiler 1. Lexical Analysis:  Converts a sequence of characters into words, or tokens 2. Syntax Analysis:  Converts a sequence of tokens into a parse tree 3. Semantic Analysis:  Manipulates parse tree to verify symbol and type information 4. Intermediate Code Generation:  Converts parse tree into a sequence of intermediate code instructions 5. Optimization:  Manipulates intermediate code to produce a more efficient program 6. Final Code Generation:  Translates intermediate code into final (machine/assembly) code 5/11/2021 Saeed Parsa 28
  • 29. The place of IUST in the world 5/11/2021 Saeed Parsa 29 https://www.researchgate.net/publication/328099969_Software_Fault_Localisation_A_Systematic_Mapping_Study