基于记忆的策略属性语法高效嵌入

José Nuno Macedo, Emanuel Rodrigues, Marcos Viera, João Saraiva
{"title":"基于记忆的策略属性语法高效嵌入","authors":"José Nuno Macedo, Emanuel Rodrigues, Marcos Viera, João Saraiva","doi":"10.1145/3571786.3573019","DOIUrl":null,"url":null,"abstract":"Strategic term re-writing and attribute grammars are two powerful programming techniques widely used in language engineering. The former relies on strategies to apply term re-write rules in defining large-scale language transformations, while the latter is suitable to express context-dependent language processing algorithms. These two techniques can be expressed and combined via a powerful navigation abstraction: generic zippers. This results in a concise zipper-based embedding offering the expressiveness of both techniques. Such elegant embedding has a severe limitation since it recomputes attribute values. This paper presents a proper and efficient embedding of both techniques. First, attribute values are memoized in the zipper data structure, thus avoiding their re-computation. Moreover, strategic zipper based functions are adapted to access such memoized values. We have implemented our memoized embedding as the Ztrategic library and we benchmarked it against the state-of-the-art Strafunski and Kiama libraries. Our first results show that we are competitive against those two well established libraries.","PeriodicalId":318756,"journal":{"name":"Proceedings of the 2023 ACM SIGPLAN International Workshop on Partial Evaluation and Program Manipulation","volume":"62 22","pages":"0"},"PeriodicalIF":0.0000,"publicationDate":"2023-01-15","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":"{\"title\":\"Efficient Embedding of Strategic Attribute Grammars via Memoization\",\"authors\":\"José Nuno Macedo, Emanuel Rodrigues, Marcos Viera, João Saraiva\",\"doi\":\"10.1145/3571786.3573019\",\"DOIUrl\":null,\"url\":null,\"abstract\":\"Strategic term re-writing and attribute grammars are two powerful programming techniques widely used in language engineering. The former relies on strategies to apply term re-write rules in defining large-scale language transformations, while the latter is suitable to express context-dependent language processing algorithms. These two techniques can be expressed and combined via a powerful navigation abstraction: generic zippers. This results in a concise zipper-based embedding offering the expressiveness of both techniques. Such elegant embedding has a severe limitation since it recomputes attribute values. This paper presents a proper and efficient embedding of both techniques. First, attribute values are memoized in the zipper data structure, thus avoiding their re-computation. Moreover, strategic zipper based functions are adapted to access such memoized values. We have implemented our memoized embedding as the Ztrategic library and we benchmarked it against the state-of-the-art Strafunski and Kiama libraries. Our first results show that we are competitive against those two well established libraries.\",\"PeriodicalId\":318756,\"journal\":{\"name\":\"Proceedings of the 2023 ACM SIGPLAN International Workshop on Partial Evaluation and Program Manipulation\",\"volume\":\"62 22\",\"pages\":\"0\"},\"PeriodicalIF\":0.0000,\"publicationDate\":\"2023-01-15\",\"publicationTypes\":\"Journal Article\",\"fieldsOfStudy\":null,\"isOpenAccess\":false,\"openAccessPdf\":\"\",\"citationCount\":\"0\",\"resultStr\":null,\"platform\":\"Semanticscholar\",\"paperid\":null,\"PeriodicalName\":\"Proceedings of the 2023 ACM SIGPLAN International Workshop on Partial Evaluation and Program Manipulation\",\"FirstCategoryId\":\"1085\",\"ListUrlMain\":\"https://doi.org/10.1145/3571786.3573019\",\"RegionNum\":0,\"RegionCategory\":null,\"ArticlePicture\":[],\"TitleCN\":null,\"AbstractTextCN\":null,\"PMCID\":null,\"EPubDate\":\"\",\"PubModel\":\"\",\"JCR\":\"\",\"JCRName\":\"\",\"Score\":null,\"Total\":0}","platform":"Semanticscholar","paperid":null,"PeriodicalName":"Proceedings of the 2023 ACM SIGPLAN International Workshop on Partial Evaluation and Program Manipulation","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.1145/3571786.3573019","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 0

摘要

策略术语重写和属性语法是在语言工程中广泛应用的两种强大的编程技术。前者依赖于在定义大规模语言转换时应用术语重写规则的策略,而后者适合于表达上下文相关的语言处理算法。这两种技术可以通过一个强大的导航抽象来表达和组合:通用拉链。这导致了一个简洁的基于拉链的嵌入,提供了这两种技术的表达性。这种优雅的嵌入有严重的局限性,因为它需要重新计算属性值。本文提出了两种技术的有效嵌入方法。首先,属性值被记在zippers数据结构中,从而避免了它们的重新计算。此外,基于策略拉链的函数被用于访问这些记忆值。我们已经将我们的记忆嵌入实现为zstrategic库,并将其与最先进的Strafunski和Kiama库进行了基准测试。我们的第一个结果表明,我们与这两个成熟的库相比是有竞争力的。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
Efficient Embedding of Strategic Attribute Grammars via Memoization
Strategic term re-writing and attribute grammars are two powerful programming techniques widely used in language engineering. The former relies on strategies to apply term re-write rules in defining large-scale language transformations, while the latter is suitable to express context-dependent language processing algorithms. These two techniques can be expressed and combined via a powerful navigation abstraction: generic zippers. This results in a concise zipper-based embedding offering the expressiveness of both techniques. Such elegant embedding has a severe limitation since it recomputes attribute values. This paper presents a proper and efficient embedding of both techniques. First, attribute values are memoized in the zipper data structure, thus avoiding their re-computation. Moreover, strategic zipper based functions are adapted to access such memoized values. We have implemented our memoized embedding as the Ztrategic library and we benchmarked it against the state-of-the-art Strafunski and Kiama libraries. Our first results show that we are competitive against those two well established libraries.
求助全文
通过发布文献求助,成功后即可免费获取论文全文。 去求助
来源期刊
自引率
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学术官方微信