简体   繁体   English

使用Java创建词法分析器程序的想法

[英]Ideas for Create a lexical analyzer program using java

我正在尝试使用java创建一个词法分析器程序。程序必须具有标记化的概念。我在编译器编程方面有初学者的知识。我知道互联网上存在很多词法生成器。我可以使用它们来测试自己的词法分析器输出。但是我需要做自己的词法分析器。任何人都可以提供一些最佳参考文献或文章或想法来开始我的工作吗?

"Compilers Principles, Techniques and Tools" by Aho Sethi and Ullman has a chapter on lexical analysers. Aho Sethi和Ullman撰写的“编译器原理,技术和工具”有一章是关于词法分析器的。 It includes a lot of the theory on regular expressions and finite automata that are core to this problem domain. 它包括很多关于正则表达式和有限自动机的理论,而这是该问题领域的核心。

I would try taking a look at the source code for some of the better ones out there. 我会尝试查看一些更好的源代码。 I have used Sablecc in the past. 我过去曾经使用过Sablecc If you go to this page describing how to to set you your environment, there is a link to the source code for it. 如果你到这个页面描述如何设置你的环境,有一个链接到它的源代码。 Antlr is also a really commonly used one. Antlr也是一个非常常用的工具。 Here is the source code for it. 这是它的源代码。

Also, The Dragon Book is really good. 另外, 《龙书》真的很好。

As Suggested by SK-logic I am adding Modern Compiler Implementation as another option. 正如SK-logic所建议的那样,我正在添加现代编译器实现作为另一种选择。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM