Yacc相当于Java [英] Yacc equivalent for Java
本文介绍了Yacc相当于Java的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用Java编写一个编译器设计项目。词法分析已经完成(使用jflex),我想知道哪种类似yacc的工具最适合(最有效,最容易使用等)进行语法分析以及原因。
I'm working on a compiler design project in Java. Lexical analysis is done (using jflex) and I'm wondering which yacc-like tool would be best(most efficient, easiest to use, etc.) for doing syntactical analysis and why.
推荐答案
如果您特别想要类似YACC的行为(表驱动),我唯一知道的是 CUP 。
If you specifically want YACC-like behavior (table-driven), the only one I know is CUP.
在Java世界中,似乎有更多人倾向于递归下降解析器,如< a href =http://www.antlr.org/ =noreferrer> ANTLR 或 JavaCC 。
In the Java world, it seems that more people lean toward recursive descent parsers like ANTLR or JavaCC.
效率很少是选择解析器生成器的理由。
And efficiency is seldom a reason to pick a parser generator.
这篇关于Yacc相当于Java的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文