{"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.