Question: To simulate deterministic finite automata, I defined a data file format that can represent these. Here it is: Line 1 - a comment line, allow

To simulate deterministic finite automata, I defined a data file format that can represent these. Here it is: Line 1 - a comment line, allow for 100 characters as in char comment[100] to read it into. Line 2 - a string to represent the alphabet used by the automaton. For example "01" or "abc" no quotes. Line 3 - an integer value for the number of states in the automaton. Lines 4 - 3+n (where n = the value in line 2) shows the delta mapping. For each state, and for each possible input, show what state that input triggers. Thus if there were 3 states (1 2 3) and state 1 on 0 went back to state 1 while 1 sent it to state 2, then the line for state 1 would read 1 2. After this is a line for the start state (like 1 for state 1).

link to input file http://cs2.uco.edu/~stockwel/pages/endba.dfa

After that we need to identify the accepting states. Have a line such as na s1 s2 s3... where na tells how many accepting states you have, and s1 s2 s3... is a list of their numbers. Finally, have a list of strings in your alphabet which the machine will either accept or reject.

Here is a link to the input file endba.dfa Write C++ code that can run against such an input file and simulate the DFA action, printing each string and either accepting or rejecting it. In this case, the language of acceptance is all of the strings of a's and b's that actually end in ba. Here is what your output should look like for the first 4 lines of input: ababaaba --> ACCEPT a --> REJECT b --> REJECT aba --> ACCEPT

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!