State Minimisation

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 11

State Minimization in

Lexical Analyzers

• Faisal A (61072111110)
• Gokul E (61072111112)
• Varun Kumar M (61072211917)
State Minimization
 The task of State minimization is to
automatically transform a given DFA into a
state-minimized DFA
 Several algorithms and variants are known
 Note that this also in effect can minimize an NFA
(since we know algorithm to convert NFA to DFA)
Hopcroft Minimization
Algorithm
 Remove all the states that are not reachable
from the initial state
 Determine 0 equivalent state,1 equivalent
state,2 equivalent state,… ,n equivalent state
 Repeat Step 2 until nth equivalent and (n-1)th
equivalent states result with same set of
strings
 Construct minimal DFA using the result
obtained in Step 3
Hopcroft Minimization
Algorithm
 The initial state of the minimized DFA is the
representative of the group containing the start state
of the original DFA

 The accepting states of the minimized DFA is the


representative of those groups that contain an
accept/final state of the original DFA
DFA
 Often representing as a diagram:
Simple Example
Simple Example

Merge s1 and s2
DFA Minimization
 This is a state-minimized (or just minimized)
DFA
 Every remaining state is necessary
DFA Minimization
 So these two DFAs are equivalent:
Conclusion
 DFA Minimization is a fairly understandable
process, and is useful in several areas
 Regular expression matching implementation
 Very similar algorithm is used for compiler
optimization to eliminate duplicate computations

 The algorithm that John Hopcraft described


is O(k (n log n) )
References
 Alfred V Aho, Monica Lam, Ravi Sethi and Jeffery D Ullman, ”Compilers –
Principles, Techniques and Tools”, Essex Pearson , Harlow, 2014.

 Keith D Copper and Linda Torczon, “Engineering a Compiler”, Second


Edition, Morgan Kaufmann Publishers Elsevier Science, 2011

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy