Good day everyone. I have an assignment and I can't get rid of this. In this programming assignment I am asked to write a computer program that simulates Nondeterministic Finite Automaton. Program will take NFA from a text file. The format in text file should be like this ;
Number of states
The alphabet
The transition function
The start state
The final(accept) states.
How can I start?

Recommended Answers

All 2 Replies

Declare a couple of data structures for say
- the alphabet
- the state

Then read the file into instances of alphabet(s) and state(s).

That would be (as you put it) a start.

If i can do it, beileve me, this topic was not here :)
By the way those who don't understand the input txt, i am giving an example.

4 // Number of States ={q0,q1,q2,q3}

0 1 // Alphabet ={0,1}

0 {1,2} * //(q0,0)=q0; (q0,1)=q0,q1

2 * 2 //(q1,0)=q2; (q1,ε)=q2

* 3 * // (q2,1)=q3

3 3 3 //(q3,0)=q3; (q3,1)=q3; (q3,ε)=q3

0 // Start = q0

3 // Accept = q3 if multi accept should be written as {q0,q1}

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.