Question: Question(C Program-DFAs). DFAs are a model computation, and a DFA is a 5-tuple (Q,,,q0,F) , where: Q is a finite set called the states, is

Question(C Program-DFAs). DFAs are a model computation, and a DFA is a 5-tuple (Q,,,q0,F), where:

  • Q is a finite set called the states,

  • is a finite set called the alphabet,

  • :QQ is the transition function,

  • q0Q is the start state, and

  • FQ is the set of accept states.

The first task is to design a data representation for this mathematical DFA definition. You may need to create multiple data representations, for various parts of the DFA.

Then, please write a C-Program that implements the DFAs as an instance of the DFA data representation that you have designed.

This program must also respond to the following stdin inputs as follows:

  • states: print out the states, one per line, in no particular order

  • alpha: print out the alphabet, one char per line, in no particular order

  • transitions: print out, in no particular order, each possible transition on its own line: "from" state first, followed by input char, followed by "to" state, with a space separating each.

  • start: print out the start state, on its own line

  • accepts: print out the accept states, one per line, in no particular order.

Input: status

Output:

q1

q2

q3

Input: transitions

Output:

q1 0 q1

q1 1 q2

q2 0 q3

q2 1 q2

q3 0 q2

q3 1 q2

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!