Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle Solaris 11.2 System Administration (oracle Press)

Authors: Harry Foxwell

1st Edition

007184421X, 9780071844215

More Books

Students also viewed these Databases questions

Question

Which day strikes you as the most interesting and why?

Answered: 1 week ago