LL(1) table-driven compilers with ANTLR or ANTLR3

梦想的初衷 提交于 2020-01-15 10:59:14

问题


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


回答1:


No.

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

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.



来源:https://stackoverflow.com/questions/9893058/ll1-table-driven-compilers-with-antlr-or-antlr3

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!