DESKTOP

Algorithms for Compiler Design: THE NFA WITH ∈-MOVES TO THE DFA

7/24/2010 7:59:17 PM
2.5 THE NFA WITH ∈-MOVES TO THE DFA
There always exists a DFA equivalent to an NFA with -moves which can be obtained as follows:

A DFA equivalent to this NFA will be:

If this transition generates a new subset of Q, then it will be added to Q1; and next time transitions from it are found, we continue in this way until we cannot add any new states to Q1. After this, we identify those states of the DFA whose subset representations contain at least one member of F. If -closure(q0) does not contain a member of F, and the set of such states of DFA constitute F1, but if -closure(q0) contains a member of F, then we identify those members of Q1 whose subset representations contain at least one member of F, or q0 and F1 will be set as a member of these states.

Consider the following NFA with -moves:

where

δ

0

1

q0

{q0}

φ

{q1}

q1

φ

{q1}

{q2}

q2

φ

{q2}

φ

A DFA equivalent to this will be:

where

δ1

0

1

{q0, q1, q2}

{q0, q1, q2}

{q1, q2}

{q1, q2}

φ

{q1, q2}

φ

φ

φ

If we identify the subsets {q0, q1, q2}, {q0, q1, q2} and φ as A, B, and C, respectively, then the automata will be:

where

δ1

0

1

A

A

B

B

C

B

C

C

C

EXAMPLE 1
Start example

Obtain a DFA equivalent to the NFA shown in Figure 1.

Click To expand
Figure 1: Example 1 NFA.

End example

A DFA equivalent to NFA in Figure 1 will be:

0

1

{q0}

{q0, q1}

{q0}

{q0, q1}

{q0, q1}

{q0, q2}

{q0, q2}

{q0, q1}

{q0, q3}

{q0, q2, q3}*

{q0, q1, q3}

{q0, q3}

{q0, q1, q3}*

{q0, q3}

{q0, q2, q3}

{q0, q3}*

{q0, q1, q3}

{q0, q3}

where {q0} corresponds to the initial state of the automata, and the states marked as * are final states. lf we rename the states as follows:

{q0}

A

{q0, q1}

B

{q0, q2}

C

{q0, q2, q3}

D

{q0, q1, q3}

E

{q0, q3}

F

then the transition table will be:

0

1

A

B

A

B

B

C

C

B

F

D*

E

F

E*

F

D

F*

E

F

EXAMPLE 2
Start example

Obtain a DFA equivalent to the NFA illustrated in Figure 2.

Click To expand
Figure 2: Example 2 DFA equivalent to an NFA.

End example

A DFA equivalent to the NFA shown in Figure 2 will be:

0

1

{q0}

{q0}

{q0, q1}

{q0, q1}

{q0, q2}

{q0, q1}

{q0, q2}

{q0}

{q0, q1, q3}

{q0, q1, q3}*

{q0, q2, q3}

{q0, q1, q3}

{q0, q2, q3}*

{q0, q3}

{q0, q1, q3}

{q0, q3}*

{q0, q3}

{q0, q1, q3}

where {q0} corresponds to the initial state of the automata, and the states marked as * are final states. If we rename the states as follows:

{q0}

A

{q0, q1}

B

{q0, q2}

C

{q0, q2, q3}

D

{q0, q1, q3}

E

{q0, q3}

F

then the transition table will be:

0

1

A

A

B

B

C

B

C

A

E

D*

F

E

E*

D

E

F*

F

E


Other  
  •  Compiler Design: MINIMIZATION/OPTIMIZATION OF A DFA
  •  Algorithms for Compiler Design: EXAMPLES OF FINITE AUTOMATA CONSTRUCTION
  •  Algorithms for Compiler Design: REGULAR SETS AND REGULAR EXPRESSIONS
  •  Algorithms for Compiler Design: OBTAINING THE REGULAR EXPRESSION FROM THE FINITE AUTOMATA
  •  Algorithms for Compiler Design: LEXICAL ANALYZER DESIGN
  •  Algorithms for Compiler Design: PROPERTIES OF REGULAR SETS
  •   Algorithms for Compiler Design: EQUIVALENCE OF TWO AUTOMATAS
  •  Algorithms for Compiler Design: CONTEXT-FREE GRAMMAR
  •  Algorithms for Compiler Design: REGULAR GRAMMAR
  •  Algorithms for Compiler Design: RIGHT LINEAR AND LEFT LINEAR GRAMMAR
  •  Algorithms for Compiler Design: Top-down parsing
  •  Algorithms for Compiler Design: Implementation
  •  Algorithms for Compiler Design: THE PREDICTIVE TOP-DOWN PARSER
  •  Algorithms for Compiler Design: A HANDLE OF A RIGHT SENTENTIAL FORM
  •  Algorithms for Compiler Design: IMPLEMENTATION in Bottom-up Parsing
  •  Algorithms for Compiler Design: THE LR PARSER
  •  Algorithms for Compiler Design: DATA STRUCTURES FOR REPRESENTING PARSING TABLES
  •  Algorithms for Compiler Design: WHY LR PARSING IS ATTRACTIVE
  •  Algorithms for Compiler Design: EXAMPLES for Bottom-up Parsing
  •  Combinations and Permutations with F#
  •  
    Most View
    Allowing Your Imagination To Flourish
    Samsung launched projector, smartphone, and 10.1'' note device
    ASP.NET 3.5 Social Networking : Messaging (part 4) - Implementing the presentation layer
    AMD Radeon HD 7950 3GB vs. Nvidia GeForce GTX 660 Ti 2GB vs. Nvidia GeForce GTX 670 2GB (Part 2)
    IIS 7.0 : Managing Administration Extensions
    Apple Corporation’s Most Important Products
    ASP.NET State Management : The Application’s State
    Programming with DirectX : Game Math - Bounding Geometry (part 1) - Bounding Boxes
    Kid developers (Part 1)
    ZTE Grand X - Big And Bold
    Top 10
    Windows Phone 8 In-Depth Review (Part 6)
    Windows Phone 8 In-Depth Review (Part 5)
    Windows Phone 8 In-Depth Review (Part 4)
    Windows Phone 8 In-Depth Review (Part 3)
    Windows Phone 8 In-Depth Review (Part 2)
    Windows Phone 8 In-Depth Review (Part 1)
    Xiaomi Phone 2 - High-End Specifications In A Surprisingly Cheap Package (Part 5)
    Xiaomi Phone 2 - High-End Specifications In A Surprisingly Cheap Package (Part 4)
    Xiaomi Phone 2 - High-End Specifications In A Surprisingly Cheap Package (Part 3)
    Xiaomi Phone 2 - High-End Specifications In A Surprisingly Cheap Package (Part 2)