更好的是ANTLR还是JavaCC? [英] What's better, ANTLR or JavaCC?

查看:269
本文介绍了更好的是ANTLR还是JavaCC?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

需要关注的是文档/学习能力,日食集成,工具,社区支持和性能(大致顺序).

Concerns are documentation/learnability, eclipse integration, tooling, community support and performance (in roughly that order).

推荐答案

您不应该排除其他几种选择:

There are a couple of alternatives you shouldn't rule out:

  • JParsec 是一个解析器组合器框架,可让您完全从代码构造解析器.
  • Scala的解析器组合框架解决了类似的问题;但是,Scala的语法使所有这些内容都更具可读性.
  • 然后还有John Metsker为他的书排名.我没有太多信息,但是我认为如果他们将其用于新的编程语言,它可能具有一些有趣的功能.
  • JParsec is a parser combinator framework that allows you to construct your parser entirely from code.
  • Scala's parser combinator framework addresses a similar concern; however, Scala's syntax makes all of this much more readable.
  • Then there's also the parser combinator framework done by John Metsker, for his book Building Parsers With Java; I don't remember exactly where the library is, but it was at least floating around on the Internet in the past. It addresses the same concern: you don't define your grammar and token definitions in a separate non-Java file; instead, it's all Java.
  • Fortress, the programming language Sun has been working on for years now seems to be build on this toolkit: Rats. I don't have much information, but I reckon if they use it for their new programming language, it probably has some interesting features.

总的来说,我的印象是代码生成器的岁月已经过去.如果要成为您,我将使用Scala的解析器组合器工具包.基本上,任何支持Scala的IDE都支持"此解析器组合器框架. AFAICT的性能很好.

In general, I get the impression that the years of the code generators are over. If I would be you, I would use Scala's parser combinator toolkit. Basically, any IDE supporting Scala, also 'supports' this parser combinator framework. Performance is good, AFAICT.

顺便说一下,ANTLR作为Eclipse插件具有相当不错的IDE支持(但也许IntelliJ中也有一些功能-我不记得了.)因此,如果您选择定义词法分析器的经典方法,并且我认为,解析器不是您的语言所用,那么ANTLR应该是您的选择.它在Java开发人员中占有最大的份额,提供工具支持,并且有ANTLR的作者撰写的精彩著作.我认为其他任何工具包都不能声称这一点.

By the way, ANTLR has quite decent IDE support, as an Eclipse plugin (but perhaps there's also something in IntelliJ - I don't remember.) So, if you would opt for the classic approach of defining your lexical analyzer and parser outside of your language, then ANTLR should be your choice, I think. It has the biggest mindshare among Java developers, there is tool support, and there is a great book by the author of ANTLR. I don't think any of the other toolkits can claim that.

这篇关于更好的是ANTLR还是JavaCC?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆