Data Types as a More Ergonomic Frontend for Grammar-Guided Genetic Programming

G. Espada, L. Ingelse, Paulo Canelas, Pedro Barbosa, Alcides Fonseca
{"title":"Data Types as a More Ergonomic Frontend for Grammar-Guided Genetic Programming","authors":"G. Espada, L. Ingelse, Paulo Canelas, Pedro Barbosa, Alcides Fonseca","doi":"10.48550/arXiv.2210.04826","DOIUrl":null,"url":null,"abstract":"Genetic Programming (GP) is an heuristic method that can be applied to many Machine Learning, Optimization and Engineering problems. In particular, it has been widely used in Software Engineering for Test-case generation, Program Synthesis and Improvement of Software (GI). Grammar-Guided Genetic Programming (GGGP) approaches allow the user to refine the domain of valid program solutions. Backus Normal Form is the most popular interface for describing Context-Free Grammars (CFG) for GGGP. BNF and its derivatives have the disadvantage of interleaving the grammar language and the target language of the program. We propose to embed the grammar as an internal Domain-Specific Language in the host language of the framework. This approach has the same expressive power as BNF and EBNF while using the host language type-system to take advantage of all the existing tooling: linters, formatters, type-checkers, autocomplete, and legacy code support. These tools have a practical utility in designing software in general, and GP systems in particular. We also present Meta-Handlers, user-defined overrides of the tree-generation system. This technique extends our object-oriented encoding with more practicability and expressive power than existing CFG approaches, achieving the same expressive power of Attribute Grammars, but without the grammar vs target language duality. Furthermore, we evidence that this approach is feasible, showing an example Python implementation as proof. We also compare our approach against textual BNF-representations w.r.t. expressive power and ergonomics. These advantages do not come at the cost of performance, as shown by our empirical evaluation on 5 benchmarks of our example implementation against PonyGE2. We conclude that our approach has better ergonomics with the same expressive power and performance of textual BNF-based grammar encodings.","PeriodicalId":423660,"journal":{"name":"Proceedings of the 21st ACM SIGPLAN International Conference on Generative Programming: Concepts and Experiences","volume":"1 1","pages":"0"},"PeriodicalIF":0.0000,"publicationDate":"2022-10-10","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"5","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"Proceedings of the 21st ACM SIGPLAN International Conference on Generative Programming: Concepts and Experiences","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.48550/arXiv.2210.04826","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 5

Abstract

Genetic Programming (GP) is an heuristic method that can be applied to many Machine Learning, Optimization and Engineering problems. In particular, it has been widely used in Software Engineering for Test-case generation, Program Synthesis and Improvement of Software (GI). Grammar-Guided Genetic Programming (GGGP) approaches allow the user to refine the domain of valid program solutions. Backus Normal Form is the most popular interface for describing Context-Free Grammars (CFG) for GGGP. BNF and its derivatives have the disadvantage of interleaving the grammar language and the target language of the program. We propose to embed the grammar as an internal Domain-Specific Language in the host language of the framework. This approach has the same expressive power as BNF and EBNF while using the host language type-system to take advantage of all the existing tooling: linters, formatters, type-checkers, autocomplete, and legacy code support. These tools have a practical utility in designing software in general, and GP systems in particular. We also present Meta-Handlers, user-defined overrides of the tree-generation system. This technique extends our object-oriented encoding with more practicability and expressive power than existing CFG approaches, achieving the same expressive power of Attribute Grammars, but without the grammar vs target language duality. Furthermore, we evidence that this approach is feasible, showing an example Python implementation as proof. We also compare our approach against textual BNF-representations w.r.t. expressive power and ergonomics. These advantages do not come at the cost of performance, as shown by our empirical evaluation on 5 benchmarks of our example implementation against PonyGE2. We conclude that our approach has better ergonomics with the same expressive power and performance of textual BNF-based grammar encodings.
查看原文
分享 分享
微信好友 朋友圈 QQ好友 复制链接
本刊更多论文
数据类型作为语法引导遗传规划的更符合人体工程学的前端
遗传规划(GP)是一种启发式方法,可以应用于许多机器学习、优化和工程问题。特别是,它已被广泛应用于软件工程中的测试用例生成、程序综合和软件改进(GI)。语法引导遗传规划(GGGP)方法允许用户细化有效的程序解决方案的领域。Backus范式是用于描述GGGP的上下文无关语法(CFG)的最流行的接口。BNF及其衍生语言的缺点是语法语言和程序的目标语言相互交错。我们建议将语法作为内部领域特定语言嵌入到框架的宿主语言中。这种方法具有与BNF和EBNF相同的表达能力,同时使用宿主语言类型系统来利用所有现有工具:编译器、格式化器、类型检查器、自动完成和遗留代码支持。这些工具通常在设计软件,特别是GP系统方面具有实用价值。我们还介绍了元处理程序,这是树生成系统的用户定义覆盖。这种技术扩展了我们的面向对象编码,比现有的CFG方法更具实用性和表达能力,实现了与属性语法相同的表达能力,但没有语法与目标语言的对偶性。此外,我们证明了这种方法是可行的,并展示了一个示例Python实现作为证明。我们还将我们的方法与文本的bnf表示、表达能力和人体工程学进行了比较。这些优势并不以性能为代价,正如我们针对PonyGE2的示例实现的5个基准测试的经验评估所示。我们得出的结论是,我们的方法具有更好的人机工程学,具有与基于文本的bnf语法编码相同的表达能力和性能。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
求助全文
约1分钟内获得全文 去求助
来源期刊
自引率
0.00%
发文量
0
期刊最新文献
A Modern C++ Point of View of Programming in Image Processing Language Support for Refactorability Decay Prevention Model-Driven IoT App Stores: Deploying Customizable Software Products to Heterogeneous Devices Generic Solution-Space Sampling for Multi-domain Product Lines Dynamic Replanning of Multi-drone Missions using Dynamic Forward Slicing
×
引用
GB/T 7714-2015
复制
MLA
复制
APA
复制
导出至
BibTeX EndNote RefMan NoteFirst NoteExpress
×
×
提示
您的信息不完整,为了账户安全,请先补充。
现在去补充
×
提示
您因"违规操作"
具体请查看互助需知
我知道了
×
提示
现在去查看 取消
×
提示
确定
0
微信
客服QQ
Book学术公众号 扫码关注我们
反馈
×
意见反馈
请填写您的意见或建议
请填写您的手机或邮箱
已复制链接
已复制链接
快去分享给好友吧!
我知道了
×
扫码分享
扫码分享
Book学术官方微信
Book学术文献互助
Book学术文献互助群
群 号:481959085
Book学术
文献互助 智能选刊 最新文献 互助须知 联系我们:info@booksci.cn
Book学术提供免费学术资源搜索服务,方便国内外学者检索中英文文献。致力于提供最便捷和优质的服务体验。
Copyright © 2023 Book学术 All rights reserved.
ghs 京公网安备 11010802042870号 京ICP备2023020795号-1