SlideShare a Scribd company logo
1 of 17
Download to read offline
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

Programming language
Programming languageProgramming language
Programming languageDhani 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 shakilZenith 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
 
Imperative programming
Imperative programmingImperative programming
Imperative programmingEdward 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 CompDavid Halliday
 
Language processing activity
Language processing activityLanguage processing activity
Language processing activityDhruv Sabalpara
 
introduction to c language
 introduction to c language introduction to c language
introduction to c languageRai University
 
Language translators
Language translatorsLanguage translators
Language translatorsAditya Sharat
 
Compiler design tutorial
Compiler design tutorialCompiler design tutorial
Compiler design tutorialHarikaReddy115
 
Lecture 1 introduction to language processors
Lecture 1  introduction to language processorsLecture 1  introduction to language processors
Lecture 1 introduction to language processorsRebaz 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.pptalireza alikhani
 
design intoduction of_COMPILER_DESIGN.pdf
design intoduction of_COMPILER_DESIGN.pdfdesign intoduction of_COMPILER_DESIGN.pdf
design intoduction of_COMPILER_DESIGN.pdfadvRajatSharma
 
Lecture1 compilers
Lecture1 compilersLecture1 compilers
Lecture1 compilersAftab Ahmad
 
Compiler design
Compiler designCompiler design
Compiler designsanchi29
 
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
 
lec00-Introduction.pdf
lec00-Introduction.pdflec00-Introduction.pdf
lec00-Introduction.pdfwigewej294
 
2 c++ programming languages
2 c++   programming languages2 c++   programming languages
2 c++ programming languagesAliMUSSA3
 
CSCorganization of programming languages
CSCorganization of programming languagesCSCorganization of programming languages
CSCorganization of programming languagesOluwafolakeOjo
 
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.pdfSwapnaliPawar27
 
Cs6660 compiler design
Cs6660 compiler designCs6660 compiler design
Cs6660 compiler designhari2010
 
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.pptxAsst.prof M.Gokilavani
 
Introduction to systems programming
Introduction to systems programmingIntroduction to systems programming
Introduction to systems programmingMukesh Tekwani
 

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 analysisRamadan 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 ratioRamadan 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 ratioRamadan 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 ratioRamadan 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 ratioRamadan 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_presentationRamadan 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_presentationRamadan 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_presentationRamadan 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_presentationRamadan Babers, PhD
 
Part01 finance investment_basics_presentation
Part01 finance investment_basics_presentationPart01 finance investment_basics_presentation
Part01 finance investment_basics_presentationRamadan 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.0Ramadan Babers, PhD
 
Classification using decision tree in detail
Classification using decision tree in detailClassification using decision tree in detail
Classification using decision tree in detailRamadan 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

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
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
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
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting DataJhengPantaleon
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppCeline George
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfUmakantAnnand
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfSumit Tiwari
 
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
 
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
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsKarinaGenton
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 

Recently uploaded (20)

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 ...
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
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
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website App
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.Compdf
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
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 🔝✔️✔️
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its Characteristics
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 

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