We present the squirrel parser, a PEG packrat parser that directly handles all forms of left recursion with optimal error recovery, while maintaining linear time complexity in the length of the input even in the presence of an arbitrary number of errors. Traditional approaches to handling left recursion in a recursive descent parser require grammar rewriting or complex algorithmic extensions. We derive a minimal algorithm from first principles: cycle detection via per-position state tracking and $O(1)$-per-LR-cycle communication from descendant to ancestor recursion frames, and fixed-point search via iterative expansion. For error recovery, we derived a set of four axioms and twelve constraints that must be imposed upon an optimal error recovery design to ensure completeness, correctness, optimality of performance, and intuitiveness of behavior. We utilized a constraint satisfaction mechanism to search the space of all possibilities, arriving at a provably optimal and robust error recovery strategy that maintains perfect performance linearity.


翻译:本文提出松鼠解析器,这是一种能够直接处理所有形式左递归并具备最优错误恢复能力的PEG记忆包解析器,即使在任意数量错误存在的情况下仍能保持输入长度级的线性时间复杂度。传统递归下降解析器处理左递归的方法需要语法重写或复杂的算法扩展。我们从基本原理推导出一个最小化算法:通过逐位置状态追踪进行环检测,建立后代递归帧到祖先递归帧的每左递归周期O(1)通信机制,并采用迭代展开的定点搜索策略。针对错误恢复问题,我们推导出包含四条公理与十二条约束的集合,这些约束必须施加于最优错误恢复设计,以确保其完备性、正确性、性能最优性及行为直观性。我们采用约束满足机制遍历所有可能性空间,最终得到可证明最优且鲁棒的错误恢复策略,该策略始终保持完美的线性性能表现。

0
下载
关闭预览

相关内容

【COLING2020】无监督依存解析的综述论文,12页pdf
专知会员服务
16+阅读 · 2020年10月27日
【反馈循环自编码器】FEEDBACK RECURRENT AUTOENCODER
专知会员服务
23+阅读 · 2020年1月28日
搜狗开源机器阅读理解工具箱
专知
19+阅读 · 2019年5月16日
数据分析师应该知道的16种回归方法:泊松回归
数萃大数据
35+阅读 · 2018年9月13日
国家自然科学基金
1+阅读 · 2017年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
4+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2014年12月31日
VIP会员
最新内容
【CMU博士论文】物理世界的视觉感知与深度理解
专知会员服务
0+阅读 · 9分钟前
伊朗战争停火期间美军关键弹药状况分析
专知会员服务
5+阅读 · 今天11:13
电子战革命:塑造战场的十年突破(2015–2025)
专知会员服务
4+阅读 · 今天9:19
人工智能即服务与未来战争(印度视角)
专知会员服务
2+阅读 · 今天7:57
《美国战争部2027财年军事人员预算》
专知会员服务
2+阅读 · 今天7:44
伊朗战争中的电子战
专知会员服务
5+阅读 · 今天7:04
大语言模型平台在国防情报应用中的对比
专知会员服务
8+阅读 · 今天3:12
相关VIP内容
【COLING2020】无监督依存解析的综述论文,12页pdf
专知会员服务
16+阅读 · 2020年10月27日
【反馈循环自编码器】FEEDBACK RECURRENT AUTOENCODER
专知会员服务
23+阅读 · 2020年1月28日
相关基金
国家自然科学基金
1+阅读 · 2017年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
4+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2014年12月31日
Top
微信扫码咨询专知VIP会员