0% found this document useful (0 votes)
9 views8 pages

Conversion of Nfa Into Dfa: Transition Table

The document outlines the process of converting Non-deterministic Finite Automata (NFA) into Deterministic Finite Automata (DFA) using examples of regular expressions (a/b)* and (a/b)*abb. It includes detailed transition tables and the minimization of states for the DFA derived from the NFA. Additionally, references for further reading on compiler theory and construction are provided.

Uploaded by

yzulkiflu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views8 pages

Conversion of Nfa Into Dfa: Transition Table

The document outlines the process of converting Non-deterministic Finite Automata (NFA) into Deterministic Finite Automata (DFA) using examples of regular expressions (a/b)* and (a/b)*abb. It includes detailed transition tables and the minimization of states for the DFA derived from the NFA. Additionally, references for further reading on compiler theory and construction are provided.

Uploaded by

yzulkiflu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

CONVERSION OF NFA INTO DFA

1. Convert the NFA (a/b)* into DFA?


Solution: ε
The NFA for (a/b)* is, a
2 3 ε
start ε ε ε
0 1 6 7
ε b ε
ε 4 5

ε closure {0} = {0,1,2,4,7} -------------- A


Transition of input symbol an on A = {3}
Transition of input symbol b on A = {5}

ε closure {3} = {3,6,1,2,4,7} ------------ B


Transition of input symbol a on B = {3 }
Transition of input symbol b on B = { 5 }

ε closure {5} = {5,6,1,2,4,7} ------------ C


Transition of input symbol a on C = { 3 }
Transition of input symbol b on C = { 5 }

Since A is the start state and state C is the only accepting state then, the transition table is,

Input symbol
State
a b
A B C
B B C
C B C

The DFA is,

a a b

Start A a b
B C

1 Conversion of NFA into DFA


2. Convert the NFA (a/b)*abb into DFA?
Solution:
The NFA for (a/b)*abb is,

a 3
2 ε
start 0 ε 1 ε 6 ε 7 a 8 b 9 b 10
ε ε
4 b 5

ε closure {0} = { 0,1,2,4,7} -------------- A


Transition of input symbol a on A = { 3,8 }
Transition of input symbol b on A = { 5 }

ε closure {3,8} = { 3,6,7,1,2,4,8} -------------- B


Transition of input symbol a on B = { 8,3 }
Transition of input symbol b on B = { 5,9 }

ε closure {5} = { 5,6,7,1,2,4} -------------- C


Transition of input symbol a on C = { 8,3 }
Transition of input symbol b on C = { 5 }

ε closure {5,9} = { 5,6,7,1,2,4,9} -------------- D


Transition of input symbol a on D = { 8,3 }
Transition of input symbol b on D = { 5,10 }

ε closure {5,10} = { 5,6,7,1,2,4,10} -------------- E


Transition of input symbol a on E = { 8,3 }
Transition of input symbol b on E = { 5 }

Since A is the start state and state E is the only accepting state then, the transition table is,

Input symbol
State
a b
A B C
B B D
C B C
D B E
E B C

2 Conversion of NFA into DFA


3 Conversion of NFA into DFA
b

C
b
b a
a
start A a B c D b E

a
a

MINIMIZATION OF STATES

Problem 1: Construct a minimum state DFA for a regular expression (a/b)* abb

Solution:-
1. The NFA of (a/b)*abb is

a 3
2 ε
start 0 ε 1 ε 6 ε 7 a 8 b 9 b 10
ε ε
4 b 5

2. Construct a DFA:

ε closure {0} = { 0,1,2,4,7} -------------- A


Transition of input symbol a on A = { 3,8 }
Transition of input symbol b on A = { 5 }

ε closure {3,8} = { 3,6,7,1,2,4,8} -------------- B


Transition of input symbol a on B = { 8,3 }
Transition of input symbol b on B = { 5,9 }

ε closure {5} = { 5,6,7,1,2,4} -------------- C


Transition of input symbol a on C = { 8,3 }
4 Conversion of NFA into DFA
Transition of input symbol b on C = { 5 }

ε closure {5,9} = { 5,6,7,1,2,4,9} -------------- D


Transition of input symbol a on D = { 8,3 }
Transition of input symbol b on D = { 5,10 }

ε closure {5,10} = { 5,6,7,1,2,4,10} -------------- E


Transition of input symbol a on E = { 8,3 }
Transition of input symbol b on E = { 5 }

Since A is the start state and state E is the only accepting state then, the transition table is,

Input symbol
State
a b
A B C
B B D
C B C
D B E
E B C

3. Minimizing the DFA

Let Π = ABCDE
The initial partition Π consists of two groups.
Π1 = ABCD ( that is the non – accepting states)
Π2 = E ( that is the accepting state)

So, (ABCD) (E)

AB
a a
A B B B

b b
A C B D

AC
a a
A B C B

b b
A C C C

5 Conversion of NFA into DFA


AD
a a
A B D B

b b
A C D E

On input “a” each of these states has a transition to B, so they could all remain in one group as
far as input a is concerned.
On input “b” A,B,C go to members of the group Π1 (ABCD) while D goes to Π2 (E) . Thus Π1
group is split into two new groups.

Π1 = ABC Π2 = D , Π3 = E
So, (ABC) (D) (E)

AB
a a
A B B B

b b
A C B D
Here B goes to Π2. Thus Π1 group is again split into two new groups. The new groups are,

Π1 = AC Π2 = B , Π3 = D, Π4 = E
So, (AC) (B) (D) (E)

Here we cannot split any of the groups consisting of the single state. The only possibility is try to
split only (AC)

For AC
a a
A B C B

b b
A C C C

But A and C go the same state B on input a, and they go to the same state C on input b.
Hence after this,
(AC) (B) (D) (E)
Here we choose A as the representative for the group AC.
Thus A is the start state and state E is the only accepting state.

6 Conversion of NFA into DFA


So the minimized transition table is,
Input symbol
State
a b
A B A
B B D
D B E
E B A

Thus the minimized DFA is,

b
b
a
start A a B b D b E

a
a

______________________________________________________________________________

7 Conversion of NFA into DFA


References

1. J. Tremblay, P.G. Sorenson,"The Theory and Practice of Compiler Writing “, McGRAW-


HILL,1985.
2. W.M. Waite, L.R. Carter,"An Introduction to Compiler Construction",Harper
Collins,New york,1993
3. A.W. Appel,"Modern Compiler Implementation in, CambridgeUniversity
Press,1998
4. Internet Papers

5. Aho, R. Sethi, J.D. Ullman," Compilers- Principles, Techniques and Tools"Addison-


Weseley, 2007

8 Conversion of NFA into DFA

You might also like