一个好的 ocaml 解析器?
我正在寻找一个好的 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这是一个库,来自 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.