NFA to DFA Algorithm

半腔热情 提交于 2020-01-14 06:12:08

问题


I've read a text file of symbols, states and transitions and put it all in a table. It looks like this:
symbols a, b
states q1, q2, q3, q4
start state q4
final state q2, q3

transition state:
q4, epsilon, q1
q1, a, q2
q3, a, q3
q3, b, q1

I've read an algorithm on how to convert NFA to DFA but I don't really understand the algorithm. How would I create transition methods and what should I have state class?


回答1:


i have a nifty link right here: JFLAP

JFLAP is an Java JAR which has some nice visualization included. You can test and transform NFAs/DFAs, do Pummping Lemma Stuff and check various grammars and such... You might give it a try!




回答2:


Do you have a programming problem, or an problem with Automata?

Because programming this it seems very simple. Yes, you'd have a state class, with 4 possible values q1-a4. The state class has a single constructor initializing it to q4. It has an Accept(symbol) function that modifies the state object, and possibly an IsEndState() function that returns true for states q2 and q3.

The NFA/DFA part comes into play in the implementation of the Accept() method. Now it coukd be that you are asked for a programmtic solution to convert an NFA-based implementation of Accept() to a DFA-based implementation of Accept().




回答3:


These two links should help you:

http://www.win.tue.nl/prose/pres/ploeger-19-10-06.pdf
http://www.cs.sun.ac.za/rw711/documentation/hopcroft2.pdf




回答4:


If you want to do it automatically without having to download something like JFLAP, give the Online NFA to DFA conversion tool a spin.

ProfBrown's "Convert NFA to DFA" video on YouTube examines how to do it in some rigor, though IMO it's impractical and unnecessarily tedious to have to write the tables up by hand. As you get used to doing the process, you'll be able to eyeball it for small graphs. In the case of large graphs, you'd use a tool to automate it, anyway.



来源:https://stackoverflow.com/questions/1340374/nfa-to-dfa-algorithm

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!