Domain Specific Languages and Their Type Systems
Total Page:16
File Type:pdf, Size:1020Kb
Domain specific languages and their type systems Citation for published version (APA): Meer, van der, A. P. (2014). Domain specific languages and their type systems. Technische Universiteit Eindhoven. https://doi.org/10.6100/IR778421 DOI: 10.6100/IR778421 Document status and date: Published: 01/01/2014 Document Version: Publisher’s PDF, also known as Version of Record (includes final page, issue and volume numbers) Please check the document version of this publication: • A submitted manuscript is the version of the article upon submission and before peer-review. There can be important differences between the submitted version and the official published version of record. People interested in the research are advised to contact the author for the final version of the publication, or visit the DOI to the publisher's website. • The final author version and the galley proof are versions of the publication after peer review. • The final published version features the final layout of the paper including the volume, issue and page numbers. Link to publication General rights Copyright and moral rights for the publications made accessible in the public portal are retained by the authors and/or other copyright owners and it is a condition of accessing publications that users recognise and abide by the legal requirements associated with these rights. • Users may download and print one copy of any publication from the public portal for the purpose of private study or research. • You may not further distribute the material or use it for any profit-making activity or commercial gain • You may freely distribute the URL identifying the publication in the public portal. If the publication is distributed under the terms of Article 25fa of the Dutch Copyright Act, indicated by the “Taverne” license above, please follow below link for the End User Agreement: www.tue.nl/taverne Take down policy If you believe that this document breaches copyright please contact us at: [email protected] providing details and we will investigate your claim. Download date: 29. Sep. 2021 Domain Specific Languages and their Type Systems PROEFSCHRIFT ter verkrijging van de graad van doctor aan de Technische Universiteit Eindhoven, op gezag van de rector magnificus prof.dr.ir. C.J. van Duijn, voor een commissie aangewezen door het College voor Promoties, in het openbaar te verdedigen op maandag 10 november 2014 om 16:00 uur door Arjan Pieter van der Meer geboren te Voorburg Dit proefschrift is goedgekeurd door de promotoren en de samenstelling van de promotiecommissie is als volgt: voorzitter: prof.dr. E.H.L. Aarts 1e promotor: prof.dr. M.G.J. van den Brand 2e promotor: prof.dr.ir. J.F. Groote copromotor(en): dr. A. Serebrenik leden: dr. ir. J.P.M. Voeten prof. dr. P.D. Mosses(Swansea University) prof.dr. M. Mernik(University of Maribor) adviseur(s): prof. dr. ir. J.E. Rooda Domain Specific Languages and their Type Systems Arjan Pieter van der Meer The work in the thesis has been carried out under the auspices of the research school IPA (Institute for Programming research and Algorithmics) IPA dissertation series 2014-10. A catalogue record is available from the Eindhoven University of Technology Library ISBN: 978-90-386-3677-1 © A. P. van der Meer, 2013 Printed by the print service of the Eindhoven University of Technology Cover design based on Wirefox © Alexander Tibus, 2005 Acknowledgements During the writing and preparation of this thesis, I received the support of many people. I would like to thank in particular: • my first promotor, Mark van den Brand, for both the opportunity to do this PhD project and for the many discussions and comments through the years. • my daily supervisor and copromotor, Alexander Serebrenik, for all the advice and innumerable review comments. • our contact with the CIF developers, Albert Hofkamp, for the helpful discusions and contributions. • the second Jan Friso Groote, for agreeing to be a member of the PhD committee and for the many helpful comments on this thesis. • the other members of the PhD committee, Marian Mernik, Peter Mosses, Jeroen Voeten and Koos Rooda, for their helpful comments. • the fellow PhD students and officemates of the SET group through the years, in no particular order:1 Marcel van Amstel, Jeroen Arnoldus, John Businge, Yanja Dajsuren, Luc Engelen, Yapin Luo, Maarten Manders, Zvezdan Protic, Ulyana Tikhonova and Bogdan Vasilescu, for their con- tributions and comradeship. • my brother and sister, Stefan and Anne Marije, for agreeing to aid me as paranymphs during the defense, and for their support through the years. • and finally my parents, Jan and Anneke, for their unwavering support. 1Well, technically speaking with last names in alphabetical order, but that is still not a particularly significant order. i ii Contents 1 Introduction 1 1.1 Software Construction . .1 1.2 Implementation . .4 1.3 Problem statement . .9 1.4 Research questions . 10 1.5 Thesis outline . 11 2 Requirements of Type System Specifications 13 2.1 Introduction . 13 2.2 Systematic Literature Review of Existing DSL Type Systems . 14 2.3 Stakeholders . 35 2.4 Requirements . 37 2.5 Conclusions . 38 3 MSOS as Type System Definition Language 41 3.1 Introduction . 41 3.2 Preliminaries . 45 3.3 MSOS and MSDF: Specifying a Type Checker . 48 3.4 Evolution of numerical types in Chi . 51 3.5 Typechecking Chi in MSOS . 52 3.6 MMT Prototype Implementation . 59 3.7 ASF+SDF Prototype Implementation . 60 3.8 Related work . 65 3.9 Conclusion . 66 4 EMF/EMF-TL Introduction 69 4.1 Introduction . 69 4.2 EMF . 70 4.3 DSL for type system specification . 73 4.4 EMF-TL semantics . 85 4.5 Implementation of EMF-TL semantics . 105 4.6 Related work . 110 4.7 Conclusions . 113 iii 5 Case studies 115 5.1 Introduction . 115 5.2 Case Study: CIF expressions . 118 5.3 Case Study: WebDSL . 123 5.4 Case Study: mCRL2 . 130 5.5 Case Study: POOSL . 141 5.6 Conclusion . 153 6 Conclusions 157 6.1 Contributions . 157 6.2 Directions for future research . 161 A Type system for SLCO 175 B Type system for CIF 179 C Type system for WebDSL 207 D Type system for mCRL2 219 E Type system for POOSL 231 F Summary 247 G Samenvatting 251 iv Chapter 1 Introduction In order to make use of any computer, we need software to control its operation. One approach to constructing such software is Model Driven Engineering or MDE. In MDE, models created using Domain Specific Languages (DSLs) play a central role. Because they are domain-specific, a large number of DSLs are needed to cover all use cases. Each of these DSLs has its own definition, and needs a separate set of tools to implement it. In this thesis, we will investigate one part of a DSL definition, the type system, and its implementation, the type checker. Our goal is to identify a specification formalism that can be used define type systems in an elegant and clear way, and that can support evolution of both its design and the corresponding tools. 1.1 Software Construction In many disciplines, computers are used to do tasks that are too large, too complex or too repetitive for humans to perform efficiently. In order for a computer to perform a task, it needs a set of instructions that specify what the task is and how it should be completed. The descriptions of tasks are called programs, and a group of programs is collectively known as software. The larger the task, the more software is needed to describe it, and the more complex it becomes to construct that software. This increasing complexity means software gets both more expensive and more error-prone. This in turn has led to the development of tools and methodologies intended to reduce the complexity of software during design and development. Model Driven Engineering One such methodology for software construction is Model Driven Engineering1 or MDE [5,15]. The primary observation of MDE is that the larger the software 1While the definition of MDE does not necessarily exclude disciplines other than software engineering, that is the primary area where it is used. 1 system becomes, the more different areas of expertise, also known as domains, it involves. If we try to combine all these different domains into one artifact, the result is, unsurprisingly, large and hard to understand. MDE advocates separat- ing all domains into their own domain models. By clearly defining models and their relations, MDE aims to improve communication about software systems, reuse of components and increase the compatibility of software systems made by different companies or different development teams. To achieve this, MDE advocates the use of models in every step of the design and development of software. Initially, these models mainly consist of concepts from the domain of the problem that the software is intended to solve. During development, these models are refined by adding more and more concepts from the domain of the implementation, where the problem will be actually solved. In order to do this efficiently, software engineers can create model transfor- mations. Model transformations are automated operations that construct new models based on old ones. If we know, for example, how to represent concepts from a problem domain in an implementation domain, we can create a trans- formation to convert entire models from one domain to another without human intervention. In order to talk about relations between concepts in different domains, we first need to define those concepts. In particular, if we want to use model trans- formations, we need to know all concepts that a particular model might contain, in order to ensure that all the information of the model can be transferred to the new model.