NFADFA Module 05 3 COP 4020 Programming Language

  • Slides: 7
Download presentation
NFA->DFA Module 05. 3 COP 4020 – Programming Language Concepts Dr. Manuel E. Bermudez

NFA->DFA Module 05. 3 COP 4020 – Programming Language Concepts Dr. Manuel E. Bermudez

NFA->DFA RGR RGL Minimum DFA RE NFA Done Soon DFA Now

NFA->DFA RGR RGL Minimum DFA RE NFA Done Soon DFA Now

NFA->DFA Deterministic Finite-State Automata (DFA’s) Definition: A deterministic FSA is defined just like an

NFA->DFA Deterministic Finite-State Automata (DFA’s) Definition: A deterministic FSA is defined just like an NFA, except that δ: Q x Σ → Q, rather than δ: Q x Σ U {ε}→ 2 Q Thus, both ε and a a are impossible. For every NFA there exists an equivalent DFA (accepting the same language).

NFA->DFA Conversion from NFA’s to DFA’s: • Simulate NFA moves with the DFA. •

NFA->DFA Conversion from NFA’s to DFA’s: • Simulate NFA moves with the DFA. • DFA start state: • NFA start state S, and all ε-reachable states from S. • Each DFA state: • a subset of the set of NFA states. • New DFA states: • Calculate the states reachable through each t Σ. • Final DFA states: • contain any NFA final state.

NFA->DFA Input State a b 123 23 456 23 23 6 456 56 ---

NFA->DFA Input State a b 123 23 456 23 23 6 456 56 --- 6 56 --56 a NFA: ----- ε 1 ε 2 b ε 4 a 23 DFA: a 123 b In general, if NFA has N states, The DFA can have as many as 2 N states. 456 3 b a 6 ε 5 b a 6 56 a

ε NFA->DFA 0 b 1 a 2 4 ε ε 5 ε a --234689

ε NFA->DFA 0 b 1 a 2 4 ε ε 5 ε a --234689 34568910 0 ε 8 3 ε State 0 1 234689 34568910 34678911 a NFA: from ba(a+b)*ab 6 b b 1 --34678911 346789 b 1 a 7 a 9 10 b 11 ε ε a a 34568910 b a 346789 234689 b DFA: b a 34678911 b

NFA->DFA RGR RGL Minimum DFA RE NFA Done Soon DFA Done

NFA->DFA RGR RGL Minimum DFA RE NFA Done Soon DFA Done