An Extension of the Interpreter Pattern to Define Domain-Parametric Rewriting Systems

L. Capra, Vincenzo Stile
{"title":"An Extension of the Interpreter Pattern to Define Domain-Parametric Rewriting Systems","authors":"L. Capra, Vincenzo Stile","doi":"10.1109/SYNASC.2013.32","DOIUrl":null,"url":null,"abstract":"The Interpreter design pattern provides an elegant and natural way of implementing systems based on term-rewriting in a OO fashion. The idea is simply associating each term of a language, either terminal or non-terminal, with a corresponding class provided with a suitable simplify() method.Reducing a term to a normal form is thus performed through a series of recursive calls to such a method.The main weakness of this approach is that it does not take into account similarities existing among different domains, thus enforcing programmers to pollute generic and domain-specific rules. The resulting code if often wordy, hard to maintain, non-reusable. In this paper we adapt the Interpreter pattern so that a clean separation between generic (common to different domains) and domain-specific rules is possible. The new pattern significantly helps design even complex rewriting systems. A running example which refers to a generic Logical domain is used throughout the paper. An application to High Level Petri nets analysis is sketched. Without any loss of generality we refer to Java as representative of a large class of languages.","PeriodicalId":293085,"journal":{"name":"2013 15th International Symposium on Symbolic and Numeric Algorithms for Scientific Computing","volume":"29 1","pages":"0"},"PeriodicalIF":0.0000,"publicationDate":"2013-09-23","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"2","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"2013 15th International Symposium on Symbolic and Numeric Algorithms for Scientific Computing","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.1109/SYNASC.2013.32","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 2

Abstract

The Interpreter design pattern provides an elegant and natural way of implementing systems based on term-rewriting in a OO fashion. The idea is simply associating each term of a language, either terminal or non-terminal, with a corresponding class provided with a suitable simplify() method.Reducing a term to a normal form is thus performed through a series of recursive calls to such a method.The main weakness of this approach is that it does not take into account similarities existing among different domains, thus enforcing programmers to pollute generic and domain-specific rules. The resulting code if often wordy, hard to maintain, non-reusable. In this paper we adapt the Interpreter pattern so that a clean separation between generic (common to different domains) and domain-specific rules is possible. The new pattern significantly helps design even complex rewriting systems. A running example which refers to a generic Logical domain is used throughout the paper. An application to High Level Petri nets analysis is sketched. Without any loss of generality we refer to Java as representative of a large class of languages.
定义域参数重写系统的解释器模式的扩展
Interpreter设计模式提供了一种优雅而自然的方式来实现基于面向对象方式的术语重写的系统。其思想是简单地将语言的每个术语(无论是终端还是非终端)与相应的类关联起来,该类提供了合适的simplify()方法。因此,通过对这种方法的一系列递归调用来执行将项简化为标准形式的操作。这种方法的主要缺点是它没有考虑到不同领域之间存在的相似性,从而迫使程序员污染通用规则和特定于领域的规则。生成的代码通常冗长,难以维护,不可重用。在本文中,我们对解释器模式进行了调整,使得通用(不同领域共有)规则和特定于领域的规则之间的清晰分离成为可能。这种新模式对设计复杂的重写系统有很大帮助。本文使用了一个通用逻辑域的实例。简述了在高级Petri网分析中的应用。在不失一般性的前提下,我们将Java称为一大语言类别的代表。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
求助全文
约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学术官方微信