词法分析和解析实用程序
我正在寻找不是 Flex 或 Bison 的词法分析和解析器生成实用程序。要求:
- 解析器使用上下文无关的 LL(*) 或 GLR 语法指定。我也会考虑 PEG。
- 与可用于脚本和应用程序开发的编程语言紧密集成。语言还应该具有与 C 轻松交互的功能。Python、Ruby 和 Guile 就是很好的例子。请不要使用 C、Java 或 Perl。我希望语言是同质的;我希望解析器生成器以相同的语言输出代码。
- 有完善的记录和生产质量。
- 开源。免费也是可取的(尽管不是必需的)。
- 与 Linux 发行版或开源 BSD 之一兼容。我会考虑 OpenSolaris。
- 快速发展比效率更令人担忧。
- 适合解析自然语言和形式语言。自然语言解析仅限于简短、含糊不清的句子。
我关注的是 ANTLR,尽管我从未使用过它。感谢对此的评论。让我知道您最喜欢的满足这些要求的实用程序是什么,以及为什么您会推荐它们。
I'm looking for lexical analysis and parser-generating utilities that are not Flex or Bison. Requirements:
- Parser is specified using a context-free LL(*) or GLR grammar. I would also consider PEGs.
- Integrates tightly with a programming language that could be used for both scripting and application development. Language should also have facilities for easily interfacing with C. Good examples are Python, Ruby, and Guile. No C, Java, or Perl please. I want the language to be homogeneous; I want the parser generator to output code in the same language.
- Well-documented and production-quality.
- Open source. Free is also desirable (although not required).
- Compatible with Linux distributions or one of the open source BSDs. I would consider OpenSolaris.
- Rapid development is a considerably greater concern than efficiency.
- Suited to parsing natural language as well as formal languages. Natural language parsing is limited to short, simple sentences with very little ambiguity.
I have my eye on ANTLR, although I have never used it. Comments to that effect are appreciated. Let me know what your favorite utilities are that meet these requirements, and why you would recommend them.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
此处提供了现代 Packrat 解析器的列表。
There is a list of modern Packrat parsers here.
NL 文本往往有很多歧义。如果你想解析自然语言,我认为任何经典的编译器类型解析器生成器(LALR、LL [包括 ANTLR])都不会帮助你,而且编译器类型解析器生成器通常根本不处理这个问题。
GLR 解析器可以处理歧义,可能会有一些用处; bison 提供此选项。
NL text tends have to lots of ambiguity. If you want to parse natural langauge, I don't think any of the classic compiler-type parser generators (LALR, LL [including ANTLR]) will help you much, and compiler type parser generators typically don't handle this at all.
A GLR parser, which does handle ambiguity, may be of some use; bison offers this as an option.
Guile 2.0(大约几天后发布)有一个 LALR(1) 解析库。
Guile 2.0 (to be released in about a few days) has an LALR(1) parsing library.