- ANTLR4自动将类似expr的左递归规则重写成非左递归形式
- ANTLR4提供优秀的错误报告功能和复杂的错误恢复机制
- ANTLR4使用了一种名为
Adaptive LL(*)的新技术 - ANTLR4几乎能处理任何文法(二义性文法/间接左递归)
- 1995年:ANTLR: A predicated‐LL(k) parser generator - Parr - 1995 - Software: Practice and Experience - Wiley Online Library
- 2011年:LL(*): the foundation of the ANTLR parser generator: ACM SIGPLAN Notices: Vol 46, No 6
- 2014年:Adaptive LL(*) parsing: the power of dynamic analysis: ACM SIGPLAN Notices: Vol 49, No 10
ANTLR是如何消除左递归的
stat:
expr ';' EOF;
expr:
| expr '*' expr
| expr '+' expr
| INT
| ID
;