Question
Will give thumbs up if the program is complete and no errors when compiling The program should do the following: read a NDFSM from the
Will give thumbs up if the program is complete and no errors when compiling
The program should do the following:
- read a NDFSM from the user specified file
- Convert to a DFSM
- repeat
ask the user to input a string which can be empty
output true if the string is accepted by the machine, false otherwise.
Until the user wants to stop
Format of the NDFSM file:
First row is alphabet separated by comma
Second row is the number of states of the NDFSM, implicitly the states are 0,1, 2.. where 0 is the initial state
Third row is the accepting states: one or more separated by comma.
The remaining rows are the transition relation, one row for each state. A transition is a triple (p, c, q), where p is the state, c is the alphabet, and q is the new state; for epsilon transition use (p, , q).
File Example1
a, b
3
1
(0, a, 1)
(1, a, 1), (1, , 2)
(2, b, 0)
File Example2
a, b
7
2, 6
(0, , 3), (0, , 4)
(3, a, 3), (3, b, 3), (3, b, 1)
(1, b, 2)
(2, a, 2), (2, b, 2)
(4, a, 4), (4, b, 4), (4, a, 5)
(5, a, 6)
(6, a, 6,), (6, b, 6)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started