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.
翻译:LL( finite) 解析 LL( k) 语法战略, 此处的 k 需要不为人知。 策略用线性时间分割输入, 使用任意但总是最小的外观来分辨非终点值的替代品, 并且对外头终端扫描次数进行优化。 对算法的修改显示, 允许以优先排序来解析语法模糊性 -- 有效地将输入解释成一种解析语法表达法 -- 以及使用上游值和概念证明, 开源解析器生成者Astir在其生成的产出中使用了LL( fite) 战略 。