【24h】

LL (*): The Foundation of the ANTLR Parser Generator

机译:LL(*):ANTLR解析器生成器的基础

获取原文
获取原文并翻译 | 示例

摘要

Despite the power of Parser Expression Grammars (PEGs) and GLR, parsing is not a solved problem. Adding nonde-terminism (parser speculation) to traditional LL and LR parsers can lead to unexpected parse-time behavior and introduces practical issues with error handling, single-step debugging, and side-effecting embedded grammar actions. This paper introduces the LL(*) parsing strategy and an associated grammar analysis algorithm that constructs LL(*) parsing decisions from ANTLR grammars. At parse-time, decisions gracefully throttle up from conventional fixed k > 1 lookahead to arbitrary lookahead and, finally, fail over to backtracking depending on the complexity of the parsing decision and the input symbols. LL(*) parsing strength reaches into the context-sensitive languages, in some cases beyond what GLR and PEGs can express. By statically removing as much speculation as possible, LL(*) provides the expressivity of PEGs while retaining LL's good error handling and unrestricted grammar actions. Widespread use of ANTLR (over 70,000 downloads/year) shows that it is effective for a wide variety of applications.
机译:尽管解析器表达语法(PEGs)和GLR具有强大的功能,但解析并不是解决的问题。在传统的LL和LR解析器中添加非确定性(解析器推测)可能会导致意外的解析时行为,并引入错误处理,单步调试和副作用嵌入式语法操作等实际问题。本文介绍了LL(*)解析策略和相关的语法分析算法,该算法从ANTLR语法构造LL(*)解析决策。在解析时,决策会从常规的固定k> 1超前缓慢地加速到任意超前,最后,根据解析决策和输入符号的复杂性,故障切换到回溯。 LL(*)的解析能力达到了上下文相关的语言,在某些情况下超出了GLR和PEG所能表达的范围。通过静态消除尽可能多的推测,LL(*)提供了PEG的表达能力,同时保留了LL的良好错误处理和不受限制的语法动作。 ANTLR的广泛使用(每年超过70,000次下载)表明,它对多种应用都是有效的。

著录项

相似文献

  • 外文文献
  • 中文文献
  • 专利
获取原文

客服邮箱:kefu@zhangqiaokeyan.com

京公网安备:11010802029741号 ICP备案号:京ICP备15016152号-6 六维联合信息科技 (北京) 有限公司©版权所有
  • 客服微信

  • 服务号