SlideShare a Scribd company logo
Compilers Design
Course
Ramadan Fawzy Mohamed Babers
Compilers Design – Lec1
Faculty of Science Helwan University
1nd Term – 2017/2018
Course Outline
 Introduction
 Lexical Analysis definition - using Regular Expressions – (REs)
 Lexical Analysis using Deterministic Finite Automata – (DFA)
 Lexical Analysis using Non-Deterministic Finite Automata – (NFA)
and Transfer NFA to DFA.
 Syntax Analysis using CFG.
 Syntax Analysis, Parsing trees and Ambiguity.
CD-Course-FSH 1st Term 2017-2018
2
Course Outline (continue)
 Removing Left Recursion and Left Factoring.
 Syntax Analysis (CFG) using Top-down parsing.
 First and Follow operators.
 Syntax analysis (CFG) using Bottom-Up (predictive/LR) parsing.
 Construction of “LR Parsing Tables” / “parsing Table LL1”.
 Semantic analysis
 Intermediate code and code generation.
3
CD-Course-FSH 1st Term 2017-2018
Why?
Why Study Compilers?
 Enhance understanding of programming languages.
 Have an in-depths knowledge of low-level machine
executables.
 Write compilers and interpreters for various
programming languages and domain-specific
languages.
 Learn various system-building tools.
 Learn interesting compiler theory and algorithms.
4
CD-Course-FSH 1st Term 2017-2018
Why?
Why Study Compilers?
5
Developer
Researcher
• Select which programming language is the best for the
problem/system on hand.
• Know how the code you are writing is compiled, and how the
compiler can intelligently optimize your code.
• Can easily gain the basic knowledge about compilers that allows
you to surf into the open research problems
• Learn how to optimize the compiler time and resources, especially
for portable devices.
CD-Course-FSH 1st Term 2017-2018
Compiler and Interpreter
Compiler
Is a special program that transforms
statements written in a particular
programming language(the source language)
into another computer language (the target
language).
6
CD-Course-FSH 1st Term 2017-2018
Compiler and Interpreter
Interpreter
Translates program one statement at a time.
7
CD-Course-FSH 1st Term 2017-2018
Compiler and Interpreter
Comparison
8
CD-Course-FSH 1st Term 2017-2018
Compiler and Interpreter
Hybrid
9
CD-Course-FSH 1st Term 2017-2018
A Language-Processing System
10
Preprocessor
A preprocessor, generally considered
as a part of compiler, is a tool that
produces input for compilers. It deals
with macro-processing, augmentation,
file inclusion, language extension, etc.
Ex: include library in C
CD-Course-FSH 1st Term 2017-2018
A Language-Processing System
11
Compiler
A compiler is a special program that
processes statements written in a
particular programming language and
turns them into machine language or
"code" that a computer's processor
uses.
CD-Course-FSH 1st Term 2017-2018
A Language-Processing System
12
Assembler
An assembler then translates the
assembly program into machine code
(object).
CD-Course-FSH 1st Term 2017-2018
A Language-Processing System
13
Linker
A linker tool is used to link all the parts
of the program together for execution
(executable machine code).
CD-Course-FSH 1st Term 2017-2018
Phases of Compiler
14
Lexical Analyzer (Scanner)
reads a stream of characters and puts them
together into some meaningful (with respect to
the source language) units called tokens.
Lexical Analyzer
(Scanner)Character
Stream
Token
Stream
CD-Course-FSH 1st Term 2017-2018
Phases of Compiler
15
Syntax Analyzer (Parsing)
• Takes a stream of tokens from the scanner,
and
• Determines if the syntax (structure) of the
program is correct according to the
(context-free) grammar of the source
language.
Syntax Analyzer
Token Syntax Tree
CD-Course-FSH 1st Term 2017-2018
Phases of Compiler
16
Syntax Analyzer (Parsing) continue
• It generates a data structure, called a
parse tree or an abstract syntax tree,
which describes the syntactic structure of
the program.
CD-Course-FSH 1st Term 2017-2018
Phases of Compiler
17
Example:
position := initial + rate * 60
would be grouped into the following tokens;
1. The identifier position
2. The assignment symbol :=
3. The identifier initial
4. The plus sign
5. The identifier rate.
6. The multiplication sign.
7. The number 60
LexicalAnalyzer
Syntax Analyzer
CD-Course-FSH 1st Term 2017-2018

More Related Content

What's hot

Introduction to programing languages part 1
Introduction to programing languages   part 1Introduction to programing languages   part 1
Introduction to programing languages part 1
university of education,Lahore
 
Presentation on C programming language
Presentation on C programming languagePresentation on C programming language
Presentation on C programming language
Arunima Education Foundation
 
Programming language
Programming languageProgramming language
Programming language
Dhani Ahmad
 
C programming slide day 01 uploadd by md abdullah al shakil
C programming slide day 01 uploadd by md abdullah al shakilC programming slide day 01 uploadd by md abdullah al shakil
C programming slide day 01 uploadd by md abdullah al shakil
Zenith SVG
 
Language processors
Language processorsLanguage processors
Language processorseShikshak
 
Principles of-programming-languages-lecture-notes-
Principles of-programming-languages-lecture-notes-Principles of-programming-languages-lecture-notes-
Principles of-programming-languages-lecture-notes-Krishna Sai
 
C Language
C LanguageC Language
C Language
TodayTutoring
 
Introduction to compilers
Introduction to compilersIntroduction to compilers
Introduction to compilers
Bilal Maqbool ツ
 
Imperative programming
Imperative programmingImperative programming
Imperative programming
Edward Blurock
 
Introduction to C Language (By: Shujaat Abbas)
Introduction to C Language (By: Shujaat Abbas)Introduction to C Language (By: Shujaat Abbas)
Introduction to C Language (By: Shujaat Abbas)
Shujaat Abbas
 
Language processor
Language processorLanguage processor
Language processorAbha Damani
 
Programming For A2 Comp
Programming For A2 CompProgramming For A2 Comp
Programming For A2 Comp
David Halliday
 
Language processing activity
Language processing activityLanguage processing activity
Language processing activity
Dhruv Sabalpara
 
introduction to c language
 introduction to c language introduction to c language
introduction to c language
Rai University
 
Language translators
Language translatorsLanguage translators
Language translatorsAditya Sharat
 
Compiler design tutorial
Compiler design tutorialCompiler design tutorial
Compiler design tutorial
HarikaReddy115
 
Programming assignment help
Programming assignment helpProgramming assignment help
Programming assignment help
www.myassignmenthelp.net
 
Lecture # 1
Lecture # 1Lecture # 1
Lecture # 1
FarwaAkramMcd
 
Lecture 1 introduction to language processors
Lecture 1  introduction to language processorsLecture 1  introduction to language processors
Lecture 1 introduction to language processors
Rebaz Najeeb
 

What's hot (19)

Introduction to programing languages part 1
Introduction to programing languages   part 1Introduction to programing languages   part 1
Introduction to programing languages part 1
 
Presentation on C programming language
Presentation on C programming languagePresentation on C programming language
Presentation on C programming language
 
Programming language
Programming languageProgramming language
Programming language
 
C programming slide day 01 uploadd by md abdullah al shakil
C programming slide day 01 uploadd by md abdullah al shakilC programming slide day 01 uploadd by md abdullah al shakil
C programming slide day 01 uploadd by md abdullah al shakil
 
Language processors
Language processorsLanguage processors
Language processors
 
Principles of-programming-languages-lecture-notes-
Principles of-programming-languages-lecture-notes-Principles of-programming-languages-lecture-notes-
Principles of-programming-languages-lecture-notes-
 
C Language
C LanguageC Language
C Language
 
Introduction to compilers
Introduction to compilersIntroduction to compilers
Introduction to compilers
 
Imperative programming
Imperative programmingImperative programming
Imperative programming
 
Introduction to C Language (By: Shujaat Abbas)
Introduction to C Language (By: Shujaat Abbas)Introduction to C Language (By: Shujaat Abbas)
Introduction to C Language (By: Shujaat Abbas)
 
Language processor
Language processorLanguage processor
Language processor
 
Programming For A2 Comp
Programming For A2 CompProgramming For A2 Comp
Programming For A2 Comp
 
Language processing activity
Language processing activityLanguage processing activity
Language processing activity
 
introduction to c language
 introduction to c language introduction to c language
introduction to c language
 
Language translators
Language translatorsLanguage translators
Language translators
 
Compiler design tutorial
Compiler design tutorialCompiler design tutorial
Compiler design tutorial
 
Programming assignment help
Programming assignment helpProgramming assignment help
Programming assignment help
 
Lecture # 1
Lecture # 1Lecture # 1
Lecture # 1
 
Lecture 1 introduction to language processors
Lecture 1  introduction to language processorsLecture 1  introduction to language processors
Lecture 1 introduction to language processors
 

Similar to Compiler lec 1

Programming Language Paradigms February.ppt
Programming Language Paradigms February.pptProgramming Language Paradigms February.ppt
Programming Language Paradigms February.ppt
alireza alikhani
 
design intoduction of_COMPILER_DESIGN.pdf
design intoduction of_COMPILER_DESIGN.pdfdesign intoduction of_COMPILER_DESIGN.pdf
design intoduction of_COMPILER_DESIGN.pdf
advRajatSharma
 
Lecture1 compilers
Lecture1 compilersLecture1 compilers
Lecture1 compilers
Aftab Ahmad
 
Compiler design
Compiler designCompiler design
Compiler design
sanchi29
 
A Research Study of Data Collection and Analysis of Semantics of Programming ...
A Research Study of Data Collection and Analysis of Semantics of Programming ...A Research Study of Data Collection and Analysis of Semantics of Programming ...
A Research Study of Data Collection and Analysis of Semantics of Programming ...
IRJET Journal
 
Programming.language
Programming.languageProgramming.language
Programming.language
PRABHAKAR SHEKHAR
 
lec00-Introduction.pdf
lec00-Introduction.pdflec00-Introduction.pdf
lec00-Introduction.pdf
wigewej294
 
2 c++ programming languages
2 c++   programming languages2 c++   programming languages
2 c++ programming languages
AliMUSSA3
 
1504.00693
1504.006931504.00693
1504.00693
Khushboo Agarwal
 
CSCorganization of programming languages
CSCorganization of programming languagesCSCorganization of programming languages
CSCorganization of programming languages
OluwafolakeOjo
 
CS3251-_PIC
CS3251-_PICCS3251-_PIC
Chapter#01 cc
Chapter#01 ccChapter#01 cc
Chapter#01 cc
abdulbaki3
 
4.LanguageProcessors and language Processing Activities.pdf
4.LanguageProcessors and language Processing Activities.pdf4.LanguageProcessors and language Processing Activities.pdf
4.LanguageProcessors and language Processing Activities.pdf
SwapnaliPawar27
 
Cs6660 compiler design
Cs6660 compiler designCs6660 compiler design
Cs6660 compiler design
hari2010
 
Unit 1_Evaluation Criteria_session 3.pptx
Unit 1_Evaluation Criteria_session 3.pptxUnit 1_Evaluation Criteria_session 3.pptx
Unit 1_Evaluation Criteria_session 3.pptx
Asst.prof M.Gokilavani
 
Ss ui lecture 1
Ss ui lecture 1Ss ui lecture 1
Ss ui lecture 1
Avinash Kapse
 
Introduction to systems programming
Introduction to systems programmingIntroduction to systems programming
Introduction to systems programming
Mukesh Tekwani
 
Chapter 5
Chapter 5Chapter 5
Chapter 5
meisaina
 

Similar to Compiler lec 1 (20)

Programming Language Paradigms February.ppt
Programming Language Paradigms February.pptProgramming Language Paradigms February.ppt
Programming Language Paradigms February.ppt
 
design intoduction of_COMPILER_DESIGN.pdf
design intoduction of_COMPILER_DESIGN.pdfdesign intoduction of_COMPILER_DESIGN.pdf
design intoduction of_COMPILER_DESIGN.pdf
 
Lecture1 compilers
Lecture1 compilersLecture1 compilers
Lecture1 compilers
 
Compiler design
Compiler designCompiler design
Compiler design
 
A Research Study of Data Collection and Analysis of Semantics of Programming ...
A Research Study of Data Collection and Analysis of Semantics of Programming ...A Research Study of Data Collection and Analysis of Semantics of Programming ...
A Research Study of Data Collection and Analysis of Semantics of Programming ...
 
Programming.language
Programming.languageProgramming.language
Programming.language
 
lec00-Introduction.pdf
lec00-Introduction.pdflec00-Introduction.pdf
lec00-Introduction.pdf
 
df
dfdf
df
 
2 c++ programming languages
2 c++   programming languages2 c++   programming languages
2 c++ programming languages
 
1504.00693
1504.006931504.00693
1504.00693
 
CSCorganization of programming languages
CSCorganization of programming languagesCSCorganization of programming languages
CSCorganization of programming languages
 
CS3251-_PIC
CS3251-_PICCS3251-_PIC
CS3251-_PIC
 
Chapter#01 cc
Chapter#01 ccChapter#01 cc
Chapter#01 cc
 
4.LanguageProcessors and language Processing Activities.pdf
4.LanguageProcessors and language Processing Activities.pdf4.LanguageProcessors and language Processing Activities.pdf
4.LanguageProcessors and language Processing Activities.pdf
 
Cs6660 compiler design
Cs6660 compiler designCs6660 compiler design
Cs6660 compiler design
 
Unit 1_Evaluation Criteria_session 3.pptx
Unit 1_Evaluation Criteria_session 3.pptxUnit 1_Evaluation Criteria_session 3.pptx
Unit 1_Evaluation Criteria_session 3.pptx
 
Ss ui lecture 1
Ss ui lecture 1Ss ui lecture 1
Ss ui lecture 1
 
SS UI Lecture 1
SS UI Lecture 1SS UI Lecture 1
SS UI Lecture 1
 
Introduction to systems programming
Introduction to systems programmingIntroduction to systems programming
Introduction to systems programming
 
Chapter 5
Chapter 5Chapter 5
Chapter 5
 

More from Ramadan Babers, PhD

Part10 finance investment limitations of ratio analysis
Part10 finance investment limitations of ratio analysisPart10 finance investment limitations of ratio analysis
Part10 finance investment limitations of ratio analysis
Ramadan Babers, PhD
 
Part09 finance investment ratio analysis investment ratio
Part09 finance investment ratio analysis investment ratioPart09 finance investment ratio analysis investment ratio
Part09 finance investment ratio analysis investment ratio
Ramadan Babers, PhD
 
Part08 finance investment ratio analysis solvency ratio
Part08 finance investment ratio analysis solvency ratioPart08 finance investment ratio analysis solvency ratio
Part08 finance investment ratio analysis solvency ratio
Ramadan Babers, PhD
 
Part07 finance investment ratio analysis profitability ratio
Part07 finance investment ratio analysis profitability ratioPart07 finance investment ratio analysis profitability ratio
Part07 finance investment ratio analysis profitability ratio
Ramadan Babers, PhD
 
Part06 finance investment ratio analysis efficiency ratio
Part06 finance investment ratio analysis efficiency ratioPart06 finance investment ratio analysis efficiency ratio
Part06 finance investment ratio analysis efficiency ratio
Ramadan Babers, PhD
 
Part05 finance investment_ratio_analysis_liquidity_ratio_presentation
Part05 finance investment_ratio_analysis_liquidity_ratio_presentationPart05 finance investment_ratio_analysis_liquidity_ratio_presentation
Part05 finance investment_ratio_analysis_liquidity_ratio_presentation
Ramadan Babers, PhD
 
Part04 finance investment_ratio_analysis_introduction_presentation
Part04 finance investment_ratio_analysis_introduction_presentationPart04 finance investment_ratio_analysis_introduction_presentation
Part04 finance investment_ratio_analysis_introduction_presentation
Ramadan Babers, PhD
 
Part03 finance investment_financial_statement_analysis_presentation
Part03 finance investment_financial_statement_analysis_presentationPart03 finance investment_financial_statement_analysis_presentation
Part03 finance investment_financial_statement_analysis_presentation
Ramadan Babers, PhD
 
Part02 finance investment_finance_and_financial_reporting_presentation
Part02 finance investment_finance_and_financial_reporting_presentationPart02 finance investment_finance_and_financial_reporting_presentation
Part02 finance investment_finance_and_financial_reporting_presentation
Ramadan Babers, PhD
 
Part01 finance investment_basics_presentation
Part01 finance investment_basics_presentationPart01 finance investment_basics_presentation
Part01 finance investment_basics_presentation
Ramadan Babers, PhD
 
Strategic Management part_03_03
Strategic Management part_03_03Strategic Management part_03_03
Strategic Management part_03_03
Ramadan Babers, PhD
 
Strategic Management part_02_03
Strategic Management part_02_03Strategic Management part_02_03
Strategic Management part_02_03
Ramadan Babers, PhD
 
Strategic Management part_01_03
Strategic Management part_01_03Strategic Management part_01_03
Strategic Management part_01_03
Ramadan Babers, PhD
 
Customer Experience (CX) updated version V9.0
Customer Experience (CX) updated version V9.0Customer Experience (CX) updated version V9.0
Customer Experience (CX) updated version V9.0
Ramadan Babers, PhD
 
Classification using decision tree in detail
Classification using decision tree in detailClassification using decision tree in detail
Classification using decision tree in detail
Ramadan Babers, PhD
 
Customer Experience (CX)
Customer Experience (CX)Customer Experience (CX)
Customer Experience (CX)
Ramadan Babers, PhD
 
Python lec 1004_ch02_excercies
Python lec 1004_ch02_excerciesPython lec 1004_ch02_excercies
Python lec 1004_ch02_excercies
Ramadan Babers, PhD
 
Python lec 1003_for_biologists
Python lec 1003_for_biologistsPython lec 1003_for_biologists
Python lec 1003_for_biologists
Ramadan Babers, PhD
 
Python lec 1002_for_biologists
Python lec 1002_for_biologistsPython lec 1002_for_biologists
Python lec 1002_for_biologists
Ramadan Babers, PhD
 
Python lec 1001_for_biologists
Python lec 1001_for_biologistsPython lec 1001_for_biologists
Python lec 1001_for_biologists
Ramadan Babers, PhD
 

More from Ramadan Babers, PhD (20)

Part10 finance investment limitations of ratio analysis
Part10 finance investment limitations of ratio analysisPart10 finance investment limitations of ratio analysis
Part10 finance investment limitations of ratio analysis
 
Part09 finance investment ratio analysis investment ratio
Part09 finance investment ratio analysis investment ratioPart09 finance investment ratio analysis investment ratio
Part09 finance investment ratio analysis investment ratio
 
Part08 finance investment ratio analysis solvency ratio
Part08 finance investment ratio analysis solvency ratioPart08 finance investment ratio analysis solvency ratio
Part08 finance investment ratio analysis solvency ratio
 
Part07 finance investment ratio analysis profitability ratio
Part07 finance investment ratio analysis profitability ratioPart07 finance investment ratio analysis profitability ratio
Part07 finance investment ratio analysis profitability ratio
 
Part06 finance investment ratio analysis efficiency ratio
Part06 finance investment ratio analysis efficiency ratioPart06 finance investment ratio analysis efficiency ratio
Part06 finance investment ratio analysis efficiency ratio
 
Part05 finance investment_ratio_analysis_liquidity_ratio_presentation
Part05 finance investment_ratio_analysis_liquidity_ratio_presentationPart05 finance investment_ratio_analysis_liquidity_ratio_presentation
Part05 finance investment_ratio_analysis_liquidity_ratio_presentation
 
Part04 finance investment_ratio_analysis_introduction_presentation
Part04 finance investment_ratio_analysis_introduction_presentationPart04 finance investment_ratio_analysis_introduction_presentation
Part04 finance investment_ratio_analysis_introduction_presentation
 
Part03 finance investment_financial_statement_analysis_presentation
Part03 finance investment_financial_statement_analysis_presentationPart03 finance investment_financial_statement_analysis_presentation
Part03 finance investment_financial_statement_analysis_presentation
 
Part02 finance investment_finance_and_financial_reporting_presentation
Part02 finance investment_finance_and_financial_reporting_presentationPart02 finance investment_finance_and_financial_reporting_presentation
Part02 finance investment_finance_and_financial_reporting_presentation
 
Part01 finance investment_basics_presentation
Part01 finance investment_basics_presentationPart01 finance investment_basics_presentation
Part01 finance investment_basics_presentation
 
Strategic Management part_03_03
Strategic Management part_03_03Strategic Management part_03_03
Strategic Management part_03_03
 
Strategic Management part_02_03
Strategic Management part_02_03Strategic Management part_02_03
Strategic Management part_02_03
 
Strategic Management part_01_03
Strategic Management part_01_03Strategic Management part_01_03
Strategic Management part_01_03
 
Customer Experience (CX) updated version V9.0
Customer Experience (CX) updated version V9.0Customer Experience (CX) updated version V9.0
Customer Experience (CX) updated version V9.0
 
Classification using decision tree in detail
Classification using decision tree in detailClassification using decision tree in detail
Classification using decision tree in detail
 
Customer Experience (CX)
Customer Experience (CX)Customer Experience (CX)
Customer Experience (CX)
 
Python lec 1004_ch02_excercies
Python lec 1004_ch02_excerciesPython lec 1004_ch02_excercies
Python lec 1004_ch02_excercies
 
Python lec 1003_for_biologists
Python lec 1003_for_biologistsPython lec 1003_for_biologists
Python lec 1003_for_biologists
 
Python lec 1002_for_biologists
Python lec 1002_for_biologistsPython lec 1002_for_biologists
Python lec 1002_for_biologists
 
Python lec 1001_for_biologists
Python lec 1001_for_biologistsPython lec 1001_for_biologists
Python lec 1001_for_biologists
 

Recently uploaded

Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
beazzy04
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
Jisc
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
DeeptiGupta154
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
Vivekanand Anglo Vedic Academy
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
Delapenabediema
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
TechSoup
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
GeoBlogs
 
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th SemesterGuidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Atul Kumar Singh
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
RaedMohamed3
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
kaushalkr1407
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
Tamralipta Mahavidyalaya
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
EugeneSaldivar
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
Special education needs
 
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdfAdversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Po-Chuan Chen
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
Jean Carlos Nunes Paixão
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
Anna Sz.
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
MIRIAMSALINAS13
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
camakaiclarkmusic
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
Sandy Millin
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
Celine George
 

Recently uploaded (20)

Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
 
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th SemesterGuidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th Semester
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
 
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdfAdversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
 

Compiler lec 1

  • 1. Compilers Design Course Ramadan Fawzy Mohamed Babers Compilers Design – Lec1 Faculty of Science Helwan University 1nd Term – 2017/2018
  • 2. Course Outline  Introduction  Lexical Analysis definition - using Regular Expressions – (REs)  Lexical Analysis using Deterministic Finite Automata – (DFA)  Lexical Analysis using Non-Deterministic Finite Automata – (NFA) and Transfer NFA to DFA.  Syntax Analysis using CFG.  Syntax Analysis, Parsing trees and Ambiguity. CD-Course-FSH 1st Term 2017-2018 2
  • 3. Course Outline (continue)  Removing Left Recursion and Left Factoring.  Syntax Analysis (CFG) using Top-down parsing.  First and Follow operators.  Syntax analysis (CFG) using Bottom-Up (predictive/LR) parsing.  Construction of “LR Parsing Tables” / “parsing Table LL1”.  Semantic analysis  Intermediate code and code generation. 3 CD-Course-FSH 1st Term 2017-2018
  • 4. Why? Why Study Compilers?  Enhance understanding of programming languages.  Have an in-depths knowledge of low-level machine executables.  Write compilers and interpreters for various programming languages and domain-specific languages.  Learn various system-building tools.  Learn interesting compiler theory and algorithms. 4 CD-Course-FSH 1st Term 2017-2018
  • 5. Why? Why Study Compilers? 5 Developer Researcher • Select which programming language is the best for the problem/system on hand. • Know how the code you are writing is compiled, and how the compiler can intelligently optimize your code. • Can easily gain the basic knowledge about compilers that allows you to surf into the open research problems • Learn how to optimize the compiler time and resources, especially for portable devices. CD-Course-FSH 1st Term 2017-2018
  • 6. Compiler and Interpreter Compiler Is a special program that transforms statements written in a particular programming language(the source language) into another computer language (the target language). 6 CD-Course-FSH 1st Term 2017-2018
  • 7. Compiler and Interpreter Interpreter Translates program one statement at a time. 7 CD-Course-FSH 1st Term 2017-2018
  • 10. A Language-Processing System 10 Preprocessor A preprocessor, generally considered as a part of compiler, is a tool that produces input for compilers. It deals with macro-processing, augmentation, file inclusion, language extension, etc. Ex: include library in C CD-Course-FSH 1st Term 2017-2018
  • 11. A Language-Processing System 11 Compiler A compiler is a special program that processes statements written in a particular programming language and turns them into machine language or "code" that a computer's processor uses. CD-Course-FSH 1st Term 2017-2018
  • 12. A Language-Processing System 12 Assembler An assembler then translates the assembly program into machine code (object). CD-Course-FSH 1st Term 2017-2018
  • 13. A Language-Processing System 13 Linker A linker tool is used to link all the parts of the program together for execution (executable machine code). CD-Course-FSH 1st Term 2017-2018
  • 14. Phases of Compiler 14 Lexical Analyzer (Scanner) reads a stream of characters and puts them together into some meaningful (with respect to the source language) units called tokens. Lexical Analyzer (Scanner)Character Stream Token Stream CD-Course-FSH 1st Term 2017-2018
  • 15. Phases of Compiler 15 Syntax Analyzer (Parsing) • Takes a stream of tokens from the scanner, and • Determines if the syntax (structure) of the program is correct according to the (context-free) grammar of the source language. Syntax Analyzer Token Syntax Tree CD-Course-FSH 1st Term 2017-2018
  • 16. Phases of Compiler 16 Syntax Analyzer (Parsing) continue • It generates a data structure, called a parse tree or an abstract syntax tree, which describes the syntactic structure of the program. CD-Course-FSH 1st Term 2017-2018
  • 17. Phases of Compiler 17 Example: position := initial + rate * 60 would be grouped into the following tokens; 1. The identifier position 2. The assignment symbol := 3. The identifier initial 4. The plus sign 5. The identifier rate. 6. The multiplication sign. 7. The number 60 LexicalAnalyzer Syntax Analyzer CD-Course-FSH 1st Term 2017-2018