Lexical Parsing Expression Recognition Schemata

M. Lumpe
{"title":"Lexical Parsing Expression Recognition Schemata","authors":"M. Lumpe","doi":"10.1109/ASWEC.2015.27","DOIUrl":null,"url":null,"abstract":"Parsing expression grammars (PEGs) have emerged as a promising substitute for context-free grammars (CFGs) and regular expressions (REs) in programming language specification. The benefits of PEGs are twofold. First, parsing expression grammars replace unordered choice between alternatives by prioritized choice, which naturally solves the ubiquitous \"dangling else\" problem in grammar definitions. Second, PEGs employ \"character-level syntax\" specifications that eliminate the need to separate the lexical and hierarchical components of a language specification. However, there is \"no free lunch\" in PEGs. PEGs capture only syntactic relationships, but many language constructs cannot be parsed without additional semantic information. Moreover, character-level specifications can become unwieldy, as every aspect of the language, including spacing, has to be accounted for. To overcome these issues, we extend the original PEG formalism to incorporate semantic predicates that yield a programmatic means for state-based token recognition control. Furthermore, rather than requiring a single complete specification, we capture lexical components as PEG closures that provide a self-contained token recognition mechanism to reduce the clutter associated with purely character-level PEGs. To test the effectiveness of our approach, we use it for the construction of a Delphi language front-end and practically confirm that Ford's theoretical linear-time result also holds for PEG closures.","PeriodicalId":310799,"journal":{"name":"2015 24th Australasian Software Engineering Conference","volume":"51 1","pages":"0"},"PeriodicalIF":0.0000,"publicationDate":"2015-09-28","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"2015 24th Australasian Software Engineering Conference","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.1109/ASWEC.2015.27","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 0

Abstract

Parsing expression grammars (PEGs) have emerged as a promising substitute for context-free grammars (CFGs) and regular expressions (REs) in programming language specification. The benefits of PEGs are twofold. First, parsing expression grammars replace unordered choice between alternatives by prioritized choice, which naturally solves the ubiquitous "dangling else" problem in grammar definitions. Second, PEGs employ "character-level syntax" specifications that eliminate the need to separate the lexical and hierarchical components of a language specification. However, there is "no free lunch" in PEGs. PEGs capture only syntactic relationships, but many language constructs cannot be parsed without additional semantic information. Moreover, character-level specifications can become unwieldy, as every aspect of the language, including spacing, has to be accounted for. To overcome these issues, we extend the original PEG formalism to incorporate semantic predicates that yield a programmatic means for state-based token recognition control. Furthermore, rather than requiring a single complete specification, we capture lexical components as PEG closures that provide a self-contained token recognition mechanism to reduce the clutter associated with purely character-level PEGs. To test the effectiveness of our approach, we use it for the construction of a Delphi language front-end and practically confirm that Ford's theoretical linear-time result also holds for PEG closures.
词汇解析表达式识别模式
解析表达式语法(peg)已经成为编程语言规范中上下文无关语法(cfg)和正则表达式(REs)的一个很有前途的替代品。挂钩货币的好处是双重的。首先,解析表达式语法用优先选择取代了选项之间的无序选择,这自然解决了语法定义中普遍存在的“悬空else”问题。其次,peg采用“字符级语法”规范,消除了分离语言规范的词法和层次组件的需要。然而,在peg中没有“免费的午餐”。peg只捕获语法关系,但是如果没有额外的语义信息,许多语言结构就无法解析。此外,字符级规范可能会变得笨拙,因为必须考虑语言的每个方面,包括间距。为了克服这些问题,我们扩展了原始的PEG形式,以合并语义谓词,从而产生基于状态的令牌识别控制的编程方法。此外,我们不需要单一完整的规范,而是将词法组件捕获为PEG闭包,提供自包含的令牌识别机制,以减少与纯字符级PEG相关的混乱。为了测试我们方法的有效性,我们将其用于Delphi语言前端的构建,并实际确认Ford的理论线性时间结果也适用于PEG闭包。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
求助全文
约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学术文献互助群
群 号:481959085
Book学术官方微信