Construct NFA for the following language and convert it into DFA using the algorithm - L = (aa+ (bb*)c*)

Compiler DesignProgramming LanguagesComputer Programming

Solution

NFA for the above language will be −

Conversion from NFA to DFA −

ε − closure(0) = {0, 1, 4} = A

For State A


For input symbol aFor input symbol bFor input symbol c
∴ Ta = {2}∴ Tb = {5}Tc = ∅
∴ ε − closure (Ta)
                       = ε
                      − closure (2)
= {2} = B
∴ ε − closure (Tb)
                        = ε
                        − closure (5)
= {5, 6, 8, 9, 11, 12} = C
∴ ε − closure (∅) = ∅
                  = D

For State B


For input symbol aFor input symbol bFor input symbol c
∴ Ta = {3}∴ Tb = {}Tc = {}
∴ ε − closure (3) =
= {3, 12} = E
 ∴ ε − closure (Tb) = { }
= ∅ = D
∴ ε − closure (Tc) = ∅ = D

For State C


For input symbol aFor input symbol bFor input symbol c
∴ Ta = {}∴ Tb = {7}Tc = {10}
∴ ε − closure (Ta) =
∅ = D
∴ ε − closure (7)
 = { 7, 8, 6, 9, 11, 12}
= F
∴ ε − closure (10)
                  = {10, 9, 11, 12}
                  = G

For State E


∴ Ta = ∅∴ Tb = ∅Tc = ∅
∴ ε − closure (Ta) =
             ∅ = D
∴ ε − closure (Tb) =
                ф = D
∴ ε − closure (Tc) =
               ф = D

For State F


∴ Ta = ∅∴ Tb = {7}Tc = {10}
∴ ε − closure (Ta) =
        ∅ = D
∴ ε − closure (Tb) =
 = ε − closure (7)
= {7,8,6,9,12}
= F
∴ ε − closure (10) =
    {10, 9, 11, 12} = G

For State G


∴ Ta = ∅∴ Tb = {7}Tc = {10}
∴ ε − closure (ф) = ф
= D
∴ ε − closure (ф) = ф =
 D
∴ ε − closure (10) =
 G

For State D

D = ∅

Ta = Tb = Tc = ∅

ε − closure (Ta) = ε − closure (Tb) = ε − closure (Tc) = ф = D

Transition Table and Diagram for DFA will be −

(Initial State)



aBcHere
ABCDA = {0,1,4}
BEDDB = {2}
CDFGC = {5,6,8,9,11,12}
DDDDD = ∅
EDDDE = {3, 12}
FDFGF = {7,8,6,9,11,12}
GDDGG = {10,9,11,12}










raja
Published on 29-Oct-2021 08:04:54
Advertisements