简体   繁体   English

DFA - >正则表达式

[英]DFA -> regular expression

I've written a DFA on paper, and want to translate it into a set of regular expressions. 我在纸上写了一个DFA,并希望将其翻译成一组正则表达式。 Does anybody know a good tool to do this? 有人知道这样做的好工具吗?

From my little google search, I found JFLAP . 从我的小谷歌搜索,我找到了JFLAP They also have a tutorial on how to Convert FA to regular expression . 他们还有一个关于如何将FA转换为正则表达式的教程。

JFLAP JFLAP

JFLAP is software for experimenting with formal languages topics including nondeterministic finite automata, nondeterministic pushdown automata, multi-tape Turing machines, several types of grammars, parsing, and L-systems. JFLAP是用于试验形式语言主题的软件,包括非确定性有限自动机,非确定性下推自动机,多磁带图灵机,几种类型的语法,解析和L系统。 In addition to constructing and testing examples for these, JFLAP allows one to experiment with construction proofs from one form to another, such as converting an NFA to a DFA to a minimal state DFA to a regular expression or regular grammar. 除了构建和测试这些示例之外,JFLAP允许人们尝试从一种形式到另一种形式的构造证明,例如将NFA转换为DFA到最小状态DFA到正则表达式或常规语法。 Click here for more information on what one can do with JFLAP. 点击此处了解有关使用JFLAP可以做些什么的更多信息。

If what you want is a parser, there's no need to translate into regular expressions as an intermediate form. 如果你想要的是一个解析器,就没有必要将正则表达式转换为中间形式。 You can code a DFA fairly straightforwardly using flex or re2c . 您可以使用flexre2c相当直接地编写DFA代码。 The coding for multiple states is not the common case, so it feels slightly unnatural at first (and it's not well covered in tutorials), but once you get rolling with it, it's really easy. 多个状态的编码不是常见的情况,所以起初感觉有点不自然(并且在教程中没有很好地介绍),但是一旦你开始使用它,它就非常容易。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM