dfa - NFA转DFA的伪代码

标签 dfa nfa

正如标题所示,我希望有人帮助我编写 NFA 到 DFA 的转换的代码。我只需要伪代码。我试过用谷歌搜索,甚至找到了整个源代码,但是几乎没有资源可以帮助我给我一个正式的方法(用书面文字,而不是通过图片)进行转换。这是一道作业题,而且我已经过了截止日期,所以在这里我真的需要一些利他主义。

谢谢。

最佳答案

我已经写了一篇关于这个主题的文章。

Converting a NFA to a DFA by subset construction

它还包含有关如何进行转换的伪代码。

算法基本上是,从NFA的起始状态开始:

Perform closure on the current state set
For each input symbol do the GOTO operation on the closure set.
   If the state set you get from the GOTO is not empty
      Do a closure of the state set.
      If it is a new set of states:
         add a transition between the state sets on the input 
         repeat the entire operation on this new set
      Else
         add a transition between the state sets on the input

执行此操作,直到不再添加任何集合或过渡。这是一个很难解释的算法,但如果你完成了 CLOSUREGOTO 这两个基本操作,这并不难。

关于dfa - NFA转DFA的伪代码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11954935/

相关文章:

automation - 为什么 L={wxw^R| w, x 属于 {a,b}^+ } 是正则语言

rust - 表驱动的词法分析需要多少缓冲?

finite-automata - 自动机理论 : Conversion of a Context free grammar to a DFA

python - 如何在代码中实现有限自动机?

regex - 从一个简单的陈述中得出 DFA(或 NFA)的步骤?

regex - 将点星正则表达式转换为 NFA

algorithm - 如何在自动机上应用 Kleene 星?

finite-automata - Dead state 是否包含在 Minimized DFA 中?

regex - 关于nfa和dfa的问题

regex - 如何使用字符范围实现正则表达式 NFA?