重新-> FSM 发生器?

发布于 2024-07-11 20:34:04 字数 1539 浏览 9 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

小忆控 2024-07-18 20:34:04

re2c 生成 C 代码。 我不确定“动态”是什么意思——据我所知,如果您想在生成代码的同一运行期间调用生成的代码,则必须编译并动态加载输出。

re2c generates C code. I'm not sure what you mean by 'dynamically' -- AFAIK you'd have to compile and dynamic-load the output, if you want to call on the generated code during the same run that you generated it.

ゃ人海孤独症 2024-07-18 20:34:04

Ragel 可能就是您正在寻找的。

它为状态机生成 C/C++/D/Ruby/Java 代码。
这些是使用正则表达式和运算符来描述的。

查了一下网站,首页写的很清楚。

Ragel may be what your are looking for.

It generates C/C++/D/Ruby/Java code for state machines.
These are described using both regular expressions and operators.

Check the website, its front page is quite explicit.

守望孤独 2024-07-18 20:34:04

它可能不完全是您正在寻找的东西,但施乐有限状态传感器支持正则表达式,构建机器,甚至可以使用 GraphViz 创建图形表示。

对于形态学之类的东西来说,这确实很漂亮,但除此之外,如果您正在寻找一些东西来探索有限状态机的理论方面,我建议您主要使用它。

两个警告:它使用自己的语法,因此它不一定会轻松翻译成您选择的语言,而且我很确定您必须获得它的许可证。 它附带了 Karttunnen 和 Beesley 的书《有限状态形态学》,这本书本身就是一本非常有趣的书。

It might not be exactly what you're looking for, but the Xerox Finite State Transducer supports regular expressions, builds the machine, and even can create a graphical representation using GraphViz.

It's really nifty for things like morphology, but otherwise, I'd suggest it mainly if you're looking something to explore the theoretical side of finite state machines.

Two caveats: it uses its own syntax, so it's not necessarily going to translate over to your languages of choice easily, and I'm pretty sure you have to get a license for it. It comes with Karttunnen and Beesley's book "Finite State Morphology", which is a very interesting read in its own right.

同展鸳鸯锦 2024-07-18 20:34:04

有限状态自动机实用程序支持从正则表达式生成 FSM。 它还支持 FSM 的 C、C++ 和 Java 代码生成。
它支持动态生成,但它是用 Prolog 编写的,从其他语言调用可能会很麻烦。

The Finite State Automata Utilities supports generation of FSM's from regular expressions. It also supports C, C++ and Java code generation for FSM's.
It supports dynamic generation, but it's written in Prolog, and calling from another language might be a hassle.

烈酒灼喉 2024-07-18 20:34:04

你需要的是一个词法分析器......有很多用于多种编程语言的词法分析器。 首先,您可以查看此处

What you're asking for is a lexer... There are plenty of them for a plethora of programming languages. For a start you can have a look here.

挽心 2024-07-18 20:34:04

从正则表达式到有限状态机的转换器的一个很好的 Python 实现是 https://github.com/ferno/greenery< /a>. 它可以通过“pip install greenery”在 pypi 上使用。

另一个 python 包使用 greenery 来实现迭代解析器:Communications Protocol Python Parser and Originator https://github.com/pjkundert/cpppo 。 也可以通过“pip install cpppo”获得。 不幸的是,Cpppo 相当复杂,这在很大程度上是由于试图在同一源中支持 Python 2 和 3,包括完整的 UTF-8 兼容性。

无论如何,cpppo 应该让您了解如何将优秀的 greenery Regex 应用于 FSM 转换器。

A good Python implementation of a converter from Regular Expression to Finite State Machine is https://github.com/ferno/greenery. It is available on pypi via 'pip install greenery'.

Another python package uses greenery to implement iterative parsers: Communications Protocol Python Parser and Originator https://github.com/pjkundert/cpppo. It is also available via 'pip install cpppo'. Cpppo is unfortunately quite complex, in no small part due to an attempt to support both Python 2 and 3 in the same source, including full UTF-8 compatibility.

Anyway, cpppo should give you an idea of how to apply the excellent greenery Regex to FSM converter.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文