Question: This assignment involves the construction of a NFA-to-DFA program. You are to work by yourself. Given a NFA, M 1 = (Q n , n
This assignment involves the construction of a NFA-to-DFA program. You are to work by yourself.
Given a NFA, M1 = (Qn, n , n, sn, Fn), write a program that will convert it to a DFA, M2 = (Qd, d,
d, sd, Fd). The states in Qn are zero-indexed integer values. This means 0 is a state, if |Qn| = 3, then Qn= {0, 1, 2}. The alphabet, n = d = , is restricted to lowercase letters.
The format for the input will consist of the following components, each on separate lines:
|Qn| The cardinality of Qn
In the form of a non-delimited string
|Fn| F1 F2 ... Fk The cardinality of Fn, followed by each of the accepting states, separated by
whitespace where k = |Fn|
sn The start state
Finally, n, the transition function, each on a line, given in 3-tuples, qi a qj. qi and qj are integer values, and a is a symbol in the alphabet, , with a space separating each.
The input example that follows is similar to Fig. 2.9 from the text on page 56:
3 ab
1 2
0
0 a 0
0 b 0
0 a 1
1 b 2
The format of the output mirrors the input. It will consist of the following components, each on separate lines:
|Qd| The cardinality of Qd
In the form of a non-delimited string
|Fd| F1 F2 ... Fk The cardinality of Fd, followed by each of the accepting states, separated by
whitespace where k = |Fd|
sd The start state
Finally, d, the transition function, each on a line, given in 3-tuples, qi a qj. qi and qj are integer values, and a is a symbol in the alphabet, , with a space separating each.
Output produced from example:
3 ab
1 2
0
0 a 1
0 b 0
1 a 1
1 b 2
2 a 1
2 b 0
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
