For and against PEGs: Why we need multi-ordered grammars

Nick Papoulias
{"title":"For and against PEGs: Why we need multi-ordered grammars","authors":"Nick Papoulias","doi":"10.7287/peerj.preprints.27358v2","DOIUrl":null,"url":null,"abstract":"Since their introduction in 2004, Parsing Expression Grammars (PEGs for short) have been gaining widespread adoption both in industry and academia. More than 400 subsequent works cite B. Ford's original paper, while a total of 29 implementations in 14 different programming languages are reported in active use. Nevertheless reviewing PEG-related bibliography reveals that the original argumentation in favor of PEGs has actually been weakened by subsequent work, regarding basic parsing features such as (a) recursion handling and (b) associativity support. To this day all proposed enhancements either address these issues in isolation or in implementation specific ways. It is still unclear if there is a single way to parse PEGs without facing these issues or introducing implementation directives external to the formalism. Our subsequent analysis takes us a step further, questioning the very core of the initial PEG proposal: (c) by design unambiguous grammars. We then discuss why a form of ordered choice and conditional operators that PEGs advocate are worth saving, but only within a wider synthesis that could address the aforementioned issues. To this end we present our on-going effort with the Gray algorithm and MOGs (Multi-Ordered Grammars), a possible alternative to the PEG and CFG formalisms.","PeriodicalId":93040,"journal":{"name":"PeerJ preprints","volume":"8 1","pages":"e27358"},"PeriodicalIF":0.0000,"publicationDate":"2018-11-19","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"PeerJ preprints","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.7287/peerj.preprints.27358v2","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 0

Abstract

Since their introduction in 2004, Parsing Expression Grammars (PEGs for short) have been gaining widespread adoption both in industry and academia. More than 400 subsequent works cite B. Ford's original paper, while a total of 29 implementations in 14 different programming languages are reported in active use. Nevertheless reviewing PEG-related bibliography reveals that the original argumentation in favor of PEGs has actually been weakened by subsequent work, regarding basic parsing features such as (a) recursion handling and (b) associativity support. To this day all proposed enhancements either address these issues in isolation or in implementation specific ways. It is still unclear if there is a single way to parse PEGs without facing these issues or introducing implementation directives external to the formalism. Our subsequent analysis takes us a step further, questioning the very core of the initial PEG proposal: (c) by design unambiguous grammars. We then discuss why a form of ordered choice and conditional operators that PEGs advocate are worth saving, but only within a wider synthesis that could address the aforementioned issues. To this end we present our on-going effort with the Gray algorithm and MOGs (Multi-Ordered Grammars), a possible alternative to the PEG and CFG formalisms.
支持和反对peg:为什么我们需要多顺序语法
自从2004年引入以来,解析表达式语法(简称peg)在工业界和学术界都得到了广泛的采用。超过400个后续作品引用了B. Ford的原始论文,而据报道,总共有14种不同编程语言的29种实现在积极使用。然而,回顾与peg相关的参考文献发现,最初支持peg的论证实际上已经被后续的工作所削弱,这些工作涉及到基本的解析特性,如(a)递归处理和(b)结合性支持。到目前为止,所有提出的增强功能要么单独解决这些问题,要么以特定于实现的方式解决这些问题。目前还不清楚是否有一种方法可以解析peg,而不需要面对这些问题或在形式主义之外引入实现指令。我们随后的分析使我们更进一步,质疑最初PEG建议的核心:(c)通过设计明确的语法。然后,我们讨论为什么peg提倡的有序选择和条件运算符的形式值得保存,但只有在更广泛的综合中才能解决上述问题。为此,我们提出了Gray算法和mog (Multi-Ordered Grammars),这是PEG和CFG形式化的一种可能的替代方案。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
求助全文
约1分钟内获得全文 求助全文
来源期刊
自引率
0.00%
发文量
0
×
引用
GB/T 7714-2015
复制
MLA
复制
APA
复制
导出至
BibTeX EndNote RefMan NoteFirst NoteExpress
×
提示
您的信息不完整,为了账户安全,请先补充。
现在去补充
×
提示
您因"违规操作"
具体请查看互助需知
我知道了
×
提示
确定
请完成安全验证×
copy
已复制链接
快去分享给好友吧!
我知道了
右上角分享
点击右上角分享
0
联系我们:info@booksci.cn Book学术提供免费学术资源搜索服务,方便国内外学者检索中英文文献。致力于提供最便捷和优质的服务体验。 Copyright © 2023 布克学术 All rights reserved.
京ICP备2023020795号-1
ghs 京公网安备 11010802042870号
Book学术文献互助
Book学术文献互助群
群 号:604180095
Book学术官方微信
小红书