使用 Python 构建编译器或解释器

发布于 2024-09-12 04:29:02 字数 1539 浏览 1 评论 0原文

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

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

发布评论

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

评论(3

萌辣 2024-09-19 04:29:02

我个人无法忍受 antlr,我使用 lex/yacc 作为我的解析器生成器。这是一个可以使用的 Python 实现 http://www.dabeaz.com/ply/

不过,这只是处理解析,实际上甚至没有开始构建您的解释器。为此,您可能会从头开始构建它 - 我从未听说过专门针对此目的的库(我很高兴看到其中的一些,如果您知道任何库,请在评论中链接我)。

查看这篇文章如何开始编写一个非常简单的程序编程语言它有很好的想法。il。

I personally can't stand antlr, I use lex/yacc as my parser generator. Here is a Python implementation http://www.dabeaz.com/ply/ that you could use.

That just deals with parsing though, that really doesn't even begin to construct your interpreter. For that, you'll probably be building it from the ground up - I've never heard of a library specifically geared towards this (I would be excited to see some of them, please link me there in the comments if you know of any).

Check out this SO post how to start writing a very simple programming language it has good ideas.il.

Smile简单爱 2024-09-19 04:29:02

也许你想看看这个

maybe you want to have a look at this

岁月无声 2024-09-19 04:29:02

我可以建议 antlr 及其 python 绑定吗?

May I suggest antlr with its python binding?

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