一个好的 ocaml 解析器?

发布于 2024-07-09 09:13:03 字数 171 浏览 6 评论 0原文

我正在寻找一个好的 ocaml 解析库,它不是 flex/bison 的衍生品。 理想情况下,我想要一个类似于秒差距的单子组合器库,但我找不到任何东西。

我会使用 haskell,但事实证明,为 haskell 制作 llvm 绑定比我最初想象的更烦人。

干杯,

杜安

I'm looking for a good ocaml parsing library that isn't a derivative of flex/bison. Ideally, I'd like a monadic combinator library along the lines of parsec, but I can't find anything.

I would use haskell, but making llvm bindings for haskell is proving more tiresome than I originally thought.

Cheers,

Duane

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

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

发布评论

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

评论(2

相对绾红妆 2024-07-16 09:13:03

这是一个库,来自 Google。 (这还提出了这个this,其中列出了几个听起来更相关的库。)

当我在中编写组合器解析器时ML,由于值的限制和急切的求值,它使用起来相当麻烦,这迫使你对语法规则进行 eta 扩展。 据说 Ocaml 对价值限制更加宽松——也许你会免受一些痛苦。

Here's one library, via Google. (Which also brought up this and this, which lists several more relevant-sounding libraries.)

When I wrote a combinator parser in ML, it turned out rather cumbersome to use because of the value restriction and eager evaluation, which forced you to eta-expand your grammar rules. Ocaml is said to be more relaxed about the value restriction, though -- maybe you'll be spared some of that pain.

在 OCaml 世界中,基于流的解析器Camlp4 是接下来的两个最常见的替代方案。 两者均已在之前的 OCaml Journal 文章中进行了详细描述。

Monadic 解析器组合器在 OCaml 中相对较少,主要是因为有几个更高级别和更高效的库可用。

In the OCaml world, stream-based parsers and Camlp4 are the next two most common alternatives. Both have been described in detail in previous OCaml Journal articles.

Monadic parser combinators are comparatively rare in OCaml, largely because there are several higher-level and vastly more efficient libraries available.

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