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会员
最新内容
从采集到决策:美军视角下的战术情报范式重构
专知会员服务
1+阅读 · 今天2:42
《履带式无人地面战车技术发展现状》
专知会员服务
2+阅读 · 今天1:46
《无人机脆弱性利用:网络空间力量的新域》
专知会员服务
2+阅读 · 8月1日
美空军如何将人工智能从战场部署至后方机关
专知会员服务
11+阅读 · 7月31日
《史诗怒火行动:多域前瞻评估》49页报告
专知会员服务
7+阅读 · 7月31日
《英国防部:未来空战系统数字化战略》33页
专知会员服务
5+阅读 · 7月31日
《面向自主飞行网络的智能体人工智能架构》
专知会员服务
7+阅读 · 7月31日
相关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会员