SlideShare a Scribd company logo
1
Compiler Construction
Vana Doufexi
2
Administrative info
 Instructor
 Name: Vana Doufexi
 E-mail: vdoufexi@cs.northwestern.edu
 Office: Ford Building, #2-229
 Hours: E-mail to set up appointment
 Teaching Assistant
 TBA
3
Administrative info
 Course webpage
 http://www.cs.northwestern.edu/academics/courses/322
 contains:
 news
 staff information
 lecture notes & other handouts
 homeworks & manuals
 policies, grades
 newsgroup info
 useful links
 Newsgroup
 Name: cs.322
 nntp: news.cs.northwestern.edu
4
What is a compiler
 A program that reads a program written in some
language and translates it into a program written in
some other language
 Modula-2 to C
 Java to bytecodes
 COOL to MIPS code
 How was the first compiler created?
5
Why study compilers?
 Application of a wide range of theoretical techniques
 Data Structures
 Theory of Computation
 Algorithms
 Computer Architecture
 Good SW engineering experience
 Better understanding of programming languages
6
Features of compilers
 Correctness
 preserve the meaning of the code
 Speed of target code
 Speed of compilation
 Good error reporting/handling
 Cooperation with the debugger
 Support for separate compilation
7
Compiler structure
 Use intermediate representation
 Why?
source
code
target
code
Front End Back End
IR
8
Compiler Structure
 Front end
 Recognize legal/illegal programs
 report/handle errors
 Generate IR
 The process can be automated
 Back end
 Translate IR into target code
 instruction selection
 register allocation
 instruction scheduling
 lots of NPC problems -- use approximations
9
Compiler Structure
 Optimization
 goals
 improve running time of generated code
 improve space, power consumption, etc.
 how?
 perform a number of transformations on the IR
 multiple passes
 important: preserve meaning of code
10
The Front End
 Scanning (a.k.a. lexical analysis)
 recognize "words" (tokens)
 Parsing (a.k.a. syntax analysis)
 check syntax
 Semantic analysis
 examine meaning (e.g. type checking)
 Other issues:
 symbol table (to keep track of identifiers)
 error detection/reporting/recovery
11
The Scanner
 Its job:
 given a character stream, recognize words (tokens)
 e.g. x = 1 becomes IDENTIFIER EQUAL INTEGER
 collect identifier information
 e.g. IDENTIFIER corresponds to a lexeme (the actual
word x) and its type (acquired from the declaration of x).
 ignore white space and comments
 report errors
 Good news
 the process can be automated
12
The Parser
 Its job:
 Check and verify syntax based on specified syntax rules
 e.g. IDENTIFIER LPAREN RPAREN make up an
EXPRESSION.
 Coming soon: how context-free grammars specify syntax
 Report errors
 Build IR
 often a syntax tree
 Good news
 the process can be automated
13
Semantic analysis
 Its job:
 Check the meaning of the program
 e.g. In x=y, is y defined before being used? Are x and y
declared?
 e.g. In x=y, are the types of x and y such that you can
assign one to the other?
 Meaning may depend on context
 Report errors
14
IRs
 Graphical
 e.g. parse tree, DAG
 Linear
 e.g. three-address code
 Hybrid
 e.g. linear for blocks of straight-line code, a graph to
connect blocks
 Low-level or high-level
15
The scanning process
 Main goal: recognize words
 How? by recognizing patterns
 e.g. an identifier is a sequence of letters or digits that starts
with a letter.
 Lexical patterns form a regular language
 Regular languages are described using regular
expressions (REs)
 Can we create an automatic RE recognizer?
 Yes! (Hold that thought)
16
The scanning process
 Definition: Regular expressions (over alphabet )
  is an RE denoting {}
 If , then  is an RE denoting {}
 If r and s are REs, then
 (r) is an RE denoting L(r)
 r|s is an RE denoting L(r)L(s)
 rs is an RE denoting L(r)L(s)
 r* is an RE denoting the Kleene closure of L(r)
 Property: REs are closed under many operations
 This allows us to build complex REs.
17
The scanning process
 Definition: Deterministic Finite Automaton
 a five-tuple (, S, , s0, F) where
  is the alphabet
 S is the set of states
  is the transition function (SS)
 s0 is the starting state
 F is the set of final states (F  S)
 Notation:
 Use a transition diagram to describe a DFA
 DFAs are equivalent to REs
 Hey! We just came up with a recognizer!
18
The scanning process
 Goal: automate the process
 Idea:
 Start with an RE
 Build a DFA
 How?
 We can build a non-deterministic finite automaton
(Thompson's construction)
 Convert that to a deterministic one
(Subset construction)
 Minimize the DFA
(Hopcroft's algorithm)
 Implement it
 Existing scanner generator: flex

More Related Content

Similar to 01.ppt

lec00-Introduction.pdf
lec00-Introduction.pdflec00-Introduction.pdf
lec00-Introduction.pdf
wigewej294
 
Compiler design Introduction
Compiler design IntroductionCompiler design Introduction
Compiler design Introduction
Aman Sharma
 
Lexical analyzer
Lexical analyzerLexical analyzer
Lexical analyzer
Ashwini Sonawane
 
Cs6660 compiler design may june 2016 Answer Key
Cs6660 compiler design may june 2016 Answer KeyCs6660 compiler design may june 2016 Answer Key
Cs6660 compiler design may june 2016 Answer Key
appasami
 
Ch 2.pptx
Ch 2.pptxCh 2.pptx
Ch 2.pptx
woldu2
 
Compiler_Lecture1.pdf
Compiler_Lecture1.pdfCompiler_Lecture1.pdf
Compiler_Lecture1.pdf
AkarTaher
 
11700220036.pdf
11700220036.pdf11700220036.pdf
11700220036.pdf
SouvikRoy149
 
Compiler design important questions
Compiler design   important questionsCompiler design   important questions
Compiler design important questions
akila viji
 
cs241-f06-final-overview
cs241-f06-final-overviewcs241-f06-final-overview
cs241-f06-final-overview
Colin Bell
 
LANGUAGE TRANSLATOR
LANGUAGE TRANSLATORLANGUAGE TRANSLATOR
Syntax analysis
Syntax analysisSyntax analysis
Computational model language and grammar bnf
Computational model language and grammar bnfComputational model language and grammar bnf
Computational model language and grammar bnf
Taha Shakeel
 
Software_engineering.pptx
Software_engineering.pptxSoftware_engineering.pptx
Software_engineering.pptx
john6938
 
F# for Scala developers
F# for Scala developersF# for Scala developers
F# for Scala developers
Alfonso Garcia-Caro
 
3a. Context Free Grammar.pdf
3a. Context Free Grammar.pdf3a. Context Free Grammar.pdf
3a. Context Free Grammar.pdf
TANZINTANZINA
 
Prof. Chethan Raj C, BE, M.Tech (Ph.D) Dept. of CSE. System Software & Operat...
Prof. Chethan Raj C, BE, M.Tech (Ph.D) Dept. of CSE. System Software & Operat...Prof. Chethan Raj C, BE, M.Tech (Ph.D) Dept. of CSE. System Software & Operat...
Prof. Chethan Raj C, BE, M.Tech (Ph.D) Dept. of CSE. System Software & Operat...
Prof Chethan Raj C
 
Programming for Problem Solving
Programming for Problem SolvingProgramming for Problem Solving
Programming for Problem Solving
Kathirvel Ayyaswamy
 
Compiler gate question key
Compiler gate question keyCompiler gate question key
Compiler gate question key
ArthyR3
 
Compiler Design.pptx
Compiler Design.pptxCompiler Design.pptx
Compiler Design.pptx
SouvikRoy149
 
Chapter-3 compiler.pptx course materials
Chapter-3 compiler.pptx course materialsChapter-3 compiler.pptx course materials
Chapter-3 compiler.pptx course materials
gadisaAdamu
 

Similar to 01.ppt (20)

lec00-Introduction.pdf
lec00-Introduction.pdflec00-Introduction.pdf
lec00-Introduction.pdf
 
Compiler design Introduction
Compiler design IntroductionCompiler design Introduction
Compiler design Introduction
 
Lexical analyzer
Lexical analyzerLexical analyzer
Lexical analyzer
 
Cs6660 compiler design may june 2016 Answer Key
Cs6660 compiler design may june 2016 Answer KeyCs6660 compiler design may june 2016 Answer Key
Cs6660 compiler design may june 2016 Answer Key
 
Ch 2.pptx
Ch 2.pptxCh 2.pptx
Ch 2.pptx
 
Compiler_Lecture1.pdf
Compiler_Lecture1.pdfCompiler_Lecture1.pdf
Compiler_Lecture1.pdf
 
11700220036.pdf
11700220036.pdf11700220036.pdf
11700220036.pdf
 
Compiler design important questions
Compiler design   important questionsCompiler design   important questions
Compiler design important questions
 
cs241-f06-final-overview
cs241-f06-final-overviewcs241-f06-final-overview
cs241-f06-final-overview
 
LANGUAGE TRANSLATOR
LANGUAGE TRANSLATORLANGUAGE TRANSLATOR
LANGUAGE TRANSLATOR
 
Syntax analysis
Syntax analysisSyntax analysis
Syntax analysis
 
Computational model language and grammar bnf
Computational model language and grammar bnfComputational model language and grammar bnf
Computational model language and grammar bnf
 
Software_engineering.pptx
Software_engineering.pptxSoftware_engineering.pptx
Software_engineering.pptx
 
F# for Scala developers
F# for Scala developersF# for Scala developers
F# for Scala developers
 
3a. Context Free Grammar.pdf
3a. Context Free Grammar.pdf3a. Context Free Grammar.pdf
3a. Context Free Grammar.pdf
 
Prof. Chethan Raj C, BE, M.Tech (Ph.D) Dept. of CSE. System Software & Operat...
Prof. Chethan Raj C, BE, M.Tech (Ph.D) Dept. of CSE. System Software & Operat...Prof. Chethan Raj C, BE, M.Tech (Ph.D) Dept. of CSE. System Software & Operat...
Prof. Chethan Raj C, BE, M.Tech (Ph.D) Dept. of CSE. System Software & Operat...
 
Programming for Problem Solving
Programming for Problem SolvingProgramming for Problem Solving
Programming for Problem Solving
 
Compiler gate question key
Compiler gate question keyCompiler gate question key
Compiler gate question key
 
Compiler Design.pptx
Compiler Design.pptxCompiler Design.pptx
Compiler Design.pptx
 
Chapter-3 compiler.pptx course materials
Chapter-3 compiler.pptx course materialsChapter-3 compiler.pptx course materials
Chapter-3 compiler.pptx course materials
 

Recently uploaded

Recycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part IIIRecycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part III
Aditya Rajan Patra
 
Low power architecture of logic gates using adiabatic techniques
Low power architecture of logic gates using adiabatic techniquesLow power architecture of logic gates using adiabatic techniques
Low power architecture of logic gates using adiabatic techniques
nooriasukmaningtyas
 
Wearable antenna for antenna applications
Wearable antenna for antenna applicationsWearable antenna for antenna applications
Wearable antenna for antenna applications
Madhumitha Jayaram
 
Heat Resistant Concrete Presentation ppt
Heat Resistant Concrete Presentation pptHeat Resistant Concrete Presentation ppt
Heat Resistant Concrete Presentation ppt
mamunhossenbd75
 
Properties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptxProperties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptx
MDSABBIROJJAMANPAYEL
 
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
awadeshbabu
 
Modelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdfModelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdf
camseq
 
DfMAy 2024 - key insights and contributions
DfMAy 2024 - key insights and contributionsDfMAy 2024 - key insights and contributions
DfMAy 2024 - key insights and contributions
gestioneergodomus
 
Generative AI leverages algorithms to create various forms of content
Generative AI leverages algorithms to create various forms of contentGenerative AI leverages algorithms to create various forms of content
Generative AI leverages algorithms to create various forms of content
Hitesh Mohapatra
 
Exception Handling notes in java exception
Exception Handling notes in java exceptionException Handling notes in java exception
Exception Handling notes in java exception
Ratnakar Mikkili
 
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressionsKuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
Victor Morales
 
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODELDEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
gerogepatton
 
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
thanhdowork
 
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdfIron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
RadiNasr
 
International Conference on NLP, Artificial Intelligence, Machine Learning an...
International Conference on NLP, Artificial Intelligence, Machine Learning an...International Conference on NLP, Artificial Intelligence, Machine Learning an...
International Conference on NLP, Artificial Intelligence, Machine Learning an...
gerogepatton
 
Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...
IJECEIAES
 
basic-wireline-operations-course-mahmoud-f-radwan.pdf
basic-wireline-operations-course-mahmoud-f-radwan.pdfbasic-wireline-operations-course-mahmoud-f-radwan.pdf
basic-wireline-operations-course-mahmoud-f-radwan.pdf
NidhalKahouli2
 
6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)
ClaraZara1
 
132/33KV substation case study Presentation
132/33KV substation case study Presentation132/33KV substation case study Presentation
132/33KV substation case study Presentation
kandramariana6
 
bank management system in java and mysql report1.pdf
bank management system in java and mysql report1.pdfbank management system in java and mysql report1.pdf
bank management system in java and mysql report1.pdf
Divyam548318
 

Recently uploaded (20)

Recycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part IIIRecycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part III
 
Low power architecture of logic gates using adiabatic techniques
Low power architecture of logic gates using adiabatic techniquesLow power architecture of logic gates using adiabatic techniques
Low power architecture of logic gates using adiabatic techniques
 
Wearable antenna for antenna applications
Wearable antenna for antenna applicationsWearable antenna for antenna applications
Wearable antenna for antenna applications
 
Heat Resistant Concrete Presentation ppt
Heat Resistant Concrete Presentation pptHeat Resistant Concrete Presentation ppt
Heat Resistant Concrete Presentation ppt
 
Properties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptxProperties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptx
 
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
 
Modelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdfModelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdf
 
DfMAy 2024 - key insights and contributions
DfMAy 2024 - key insights and contributionsDfMAy 2024 - key insights and contributions
DfMAy 2024 - key insights and contributions
 
Generative AI leverages algorithms to create various forms of content
Generative AI leverages algorithms to create various forms of contentGenerative AI leverages algorithms to create various forms of content
Generative AI leverages algorithms to create various forms of content
 
Exception Handling notes in java exception
Exception Handling notes in java exceptionException Handling notes in java exception
Exception Handling notes in java exception
 
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressionsKuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
 
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODELDEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
 
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
 
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdfIron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
 
International Conference on NLP, Artificial Intelligence, Machine Learning an...
International Conference on NLP, Artificial Intelligence, Machine Learning an...International Conference on NLP, Artificial Intelligence, Machine Learning an...
International Conference on NLP, Artificial Intelligence, Machine Learning an...
 
Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...
 
basic-wireline-operations-course-mahmoud-f-radwan.pdf
basic-wireline-operations-course-mahmoud-f-radwan.pdfbasic-wireline-operations-course-mahmoud-f-radwan.pdf
basic-wireline-operations-course-mahmoud-f-radwan.pdf
 
6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)
 
132/33KV substation case study Presentation
132/33KV substation case study Presentation132/33KV substation case study Presentation
132/33KV substation case study Presentation
 
bank management system in java and mysql report1.pdf
bank management system in java and mysql report1.pdfbank management system in java and mysql report1.pdf
bank management system in java and mysql report1.pdf
 

01.ppt

  • 2. 2 Administrative info  Instructor  Name: Vana Doufexi  E-mail: vdoufexi@cs.northwestern.edu  Office: Ford Building, #2-229  Hours: E-mail to set up appointment  Teaching Assistant  TBA
  • 3. 3 Administrative info  Course webpage  http://www.cs.northwestern.edu/academics/courses/322  contains:  news  staff information  lecture notes & other handouts  homeworks & manuals  policies, grades  newsgroup info  useful links  Newsgroup  Name: cs.322  nntp: news.cs.northwestern.edu
  • 4. 4 What is a compiler  A program that reads a program written in some language and translates it into a program written in some other language  Modula-2 to C  Java to bytecodes  COOL to MIPS code  How was the first compiler created?
  • 5. 5 Why study compilers?  Application of a wide range of theoretical techniques  Data Structures  Theory of Computation  Algorithms  Computer Architecture  Good SW engineering experience  Better understanding of programming languages
  • 6. 6 Features of compilers  Correctness  preserve the meaning of the code  Speed of target code  Speed of compilation  Good error reporting/handling  Cooperation with the debugger  Support for separate compilation
  • 7. 7 Compiler structure  Use intermediate representation  Why? source code target code Front End Back End IR
  • 8. 8 Compiler Structure  Front end  Recognize legal/illegal programs  report/handle errors  Generate IR  The process can be automated  Back end  Translate IR into target code  instruction selection  register allocation  instruction scheduling  lots of NPC problems -- use approximations
  • 9. 9 Compiler Structure  Optimization  goals  improve running time of generated code  improve space, power consumption, etc.  how?  perform a number of transformations on the IR  multiple passes  important: preserve meaning of code
  • 10. 10 The Front End  Scanning (a.k.a. lexical analysis)  recognize "words" (tokens)  Parsing (a.k.a. syntax analysis)  check syntax  Semantic analysis  examine meaning (e.g. type checking)  Other issues:  symbol table (to keep track of identifiers)  error detection/reporting/recovery
  • 11. 11 The Scanner  Its job:  given a character stream, recognize words (tokens)  e.g. x = 1 becomes IDENTIFIER EQUAL INTEGER  collect identifier information  e.g. IDENTIFIER corresponds to a lexeme (the actual word x) and its type (acquired from the declaration of x).  ignore white space and comments  report errors  Good news  the process can be automated
  • 12. 12 The Parser  Its job:  Check and verify syntax based on specified syntax rules  e.g. IDENTIFIER LPAREN RPAREN make up an EXPRESSION.  Coming soon: how context-free grammars specify syntax  Report errors  Build IR  often a syntax tree  Good news  the process can be automated
  • 13. 13 Semantic analysis  Its job:  Check the meaning of the program  e.g. In x=y, is y defined before being used? Are x and y declared?  e.g. In x=y, are the types of x and y such that you can assign one to the other?  Meaning may depend on context  Report errors
  • 14. 14 IRs  Graphical  e.g. parse tree, DAG  Linear  e.g. three-address code  Hybrid  e.g. linear for blocks of straight-line code, a graph to connect blocks  Low-level or high-level
  • 15. 15 The scanning process  Main goal: recognize words  How? by recognizing patterns  e.g. an identifier is a sequence of letters or digits that starts with a letter.  Lexical patterns form a regular language  Regular languages are described using regular expressions (REs)  Can we create an automatic RE recognizer?  Yes! (Hold that thought)
  • 16. 16 The scanning process  Definition: Regular expressions (over alphabet )   is an RE denoting {}  If , then  is an RE denoting {}  If r and s are REs, then  (r) is an RE denoting L(r)  r|s is an RE denoting L(r)L(s)  rs is an RE denoting L(r)L(s)  r* is an RE denoting the Kleene closure of L(r)  Property: REs are closed under many operations  This allows us to build complex REs.
  • 17. 17 The scanning process  Definition: Deterministic Finite Automaton  a five-tuple (, S, , s0, F) where   is the alphabet  S is the set of states   is the transition function (SS)  s0 is the starting state  F is the set of final states (F  S)  Notation:  Use a transition diagram to describe a DFA  DFAs are equivalent to REs  Hey! We just came up with a recognizer!
  • 18. 18 The scanning process  Goal: automate the process  Idea:  Start with an RE  Build a DFA  How?  We can build a non-deterministic finite automaton (Thompson's construction)  Convert that to a deterministic one (Subset construction)  Minimize the DFA (Hopcroft's algorithm)  Implement it  Existing scanner generator: flex