【发布时间】:2018-08-27 09:16:38
【问题描述】:
我需要实现以下 NFA:
我用函数表示每个状态,但是在给定输入的情况下,我很难获得所有可能的路径。
例如,输入“bb”我应该有下一个输出:
Path 1: 1, 5, 1
Path 2: 1, 5, 3
Path 3: 1, 5, 7
Path 4: 1, 5, 9
我试图用列表列表或字典来表示转换,但我似乎找不到获取所有可能路径的方法。
【问题讨论】:
-
这可能很多,但我实际上为 Lexer-Parser 库编写了 NFA 和 DFA 的 oop 实现。想看的话:github.com/omelancon/ComPyl/blob/master/compyl/__lexer/…
标签: python state transition automata nfa