计算机科学 > 程序设计语言
[提交于 2020年10月15日 (v1),最后修订于 2021年1月20日 (此版本, v2)]
标题:The LL(finite) strategy for optimal LL(k) parsing
查看原文 PDF 中文 PDF (下批处理) EasyResearch 阅读摘要:The LL(finite) parsing strategy for parsing of LL(k) grammars where k needs not to be known is presented. The strategy parses input in linear time, uses arbitrary but always minimal lookahead necessary to disambiguate between alternatives of nonterminals, and it is optimal in the number of lookahead terminal scans performed. Modifications to the algorithm are shown that allow for resolution of grammar ambiguities by precedence -- effectively interpreting the input as a parsing expression grammar -- as well as for the use of predicates, and a proof of concept, the open-source parser generator Astir, employs the LL(finite) strategy in the output it generates.