The NFA is given as text file in a specific format to make parsing easy.The corresponding DFA is written to an output text file.
Click THIS to go the GitHub program.
Algorithm
nfa.txt
//states
q0 q1 q2
//input_symbols
0 1
//start_state
q0
//final_state
q2
//transitions of the form : intial_state input final_state
q0 0 q2
q1 1 q0,q2
q2 0 q0,q1
q2 1 q0
output.txt
Start states:{q0}
({q0},0) = q2
({q2},0) = q0 q1
({q0,q1},0) = q2
({q0,q1},1) = q0 q2
({q0,q2},0) = q0 q1 q2
({q0,q1,q2},0) = q0 q1 q2
({q0,q1,q2},1) = q0 q2
({q0,q2},1) = q0
({q2},1) = q0
({q0},1) =
States : {q0} {q2} {q0,q1} {q0,q2} {q0,q1,q2}
Final States : {q2} {q0,q2} {q0,q1,q2}
NOTE : The states of the NFA can be represented as numbers only. Alphabets won't work.
program.c
Click THIS to go the GitHub program.
Algorithm
nfa.txt
//states
q0 q1 q2
//input_symbols
0 1
//start_state
q0
//final_state
q2
//transitions of the form : intial_state input final_state
q0 0 q2
q1 1 q0,q2
q2 0 q0,q1
q2 1 q0
output.txt
Start states:{q0}
({q0},0) = q2
({q2},0) = q0 q1
({q0,q1},0) = q2
({q0,q1},1) = q0 q2
({q0,q2},0) = q0 q1 q2
({q0,q1,q2},0) = q0 q1 q2
({q0,q1,q2},1) = q0 q2
({q0,q2},1) = q0
({q2},1) = q0
({q0},1) =
States : {q0} {q2} {q0,q1} {q0,q2} {q0,q1,q2}
Final States : {q2} {q0,q2} {q0,q1,q2}
NOTE : The states of the NFA can be represented as numbers only. Alphabets won't work.
program.c