LL(1)表驱动编译器与ANTLR或ANTLR3 [英] LL(1) table-driven compilers with ANTLR or ANTLR3

查看:283
本文介绍了LL(1)表驱动编译器与ANTLR或ANTLR3的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以使用ANTLR或ANTLR3创建一个LL(1)表驱动(非递归)编译器?

Is it possible to create a LL(1) table-driven (non-recursive) compiler with ANTLR or ANTLR3 ?

推荐答案

然而,由于ANTLR是开源的,你可以修改ANTLR的分支。

However since ANTLR is open source you could modify a fork of ANTLR to do it.

ANTLR将词法分析器和解析器构建为递归下降源代码。这就是为什么ANTLR易于使用和流行,因为人们可以看看源代码,了解词法分析器和解析器如何工作而不是查看表条目。因为它是源代码,还可以使用工具来调试源代码。如果ANTLR使用表而不是源代码输出,那么它将失去对那些学习词法和解析自己的理解和有用性。

ANTLR builds lexers and parsers as recursive descent source code. This is why ANTLR is easy to use and popular because people can look at the source code and understand how the lexer and parser work versus looking at table entries. Because it is source code, one can also use tools to debug the source code. If ANTLR used tables instead of source code output it would lose its ease of understanding and usefulness for those learning lexing and parsing on their own.

这篇关于LL(1)表驱动编译器与ANTLR或ANTLR3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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