Abstract
One of the strengths of the Jetbrains MPS projectional language workbench is that it supports mixing different kinds of notations (graphical, tabular, textual, etc.). Many existing languages, however, are fully textual and are defined using grammar technology. To allow such languages to be used from within MPS, language engineers have to manually recreate the syntax of a language using MPS concepts. In this chapter, we present an approach to automatically convert grammar-based languages to MPS languages, by mapping context-free grammars to MPS concept hierarchies. In addition, parse trees of programs in those languages are mapped to MPS models. As a result, MPS users can import textual languages and their programs into MPS without having to write tedious boilerplate code. We have implemented the approach in a tool, Rascal2MPS, which converts grammars in the built-in grammar formalism of Rascal to MPS. Although the tool is specific for the Rascal context, the underlying approach is generic and can be instantiated for other grammar formalisms. We have evaluated Rascal2MPS by generating an importer for a realistic programming language (ECMAScript 5). The results show that useable MPS editors for such languages can obtained but that further research is needed to improve their layout.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
References
Erdweg, S., van der Storm, T., Volter, M., Tratt, L., Bosman, R., Cook, W.R., Gerritsen, A., Hulshout, A., Kelly, S., Loh, A., Konat, G., Molina, P.J., Palatnik, M., Pohjonen, R., Schindler, E., Schindler, K., Solmi, R., Vergu, V., Visser, E., van der Vlist, K., Wachsmuth, G., van der Woning, J.: Evaluating and comparing language workbenches: Existing results and benchmarks for the future. Comput. Lang. Syst. Struct. 44, 24–47 (2015)
Lämmel, R.: The Notion of a Software Language, pp. 1–49. Springer International Publishing, Cham (2018)
Fowler, M.: Language workbenches: The killer-app for domain specific languages? (2015)
Mernik, M., Heering, J., Sloane, A.M.: When and how to develop domain-specific languages. ACM Comput. Surv. (CSUR) 37(4), 316–344 (2005)
Mengerink, J.G.M., van der Sanden, B., Cappers, B.C.M., Serebrenik, A., Schiffelers, R.R.H., van den Brand, M.G.J.: Exploring DSL evolutionary patterns in practice - a study of dsl evolution in a large-scale industrial DSL repository. In: Proceedings of the 6th International Conference on Model-Driven Engineering and Software Development - Volume 1: MODELSWARD, pp. 446–453. INSTICC, SciTePress (2018)
Bartels, J.: Bridging the worlds of textual and projectional language workbenches. Master’s thesis, Eindhoven University of Technology, 1 2020
Mooij, A.J., Hooman, J., Albers, R.: Gaining industrial confidence for the introduction of domain-specific languages. In: 2013 IEEE 37th Annual Computer Software and Applications Conference Workshops, pp. 662–667 (2013)
van Deursen, A., Klint, P., Visser, J.: Domain-specific languages: An annotated bibliography. SIGPLAN Not. 35(6), 26–36 (2000)
Krueger, C.W.: Software reuse. ACM Comput. Surv. 24(2), 131–183 (1992)
Nagy, I., Cleophas, L., van den Brand, M., Engelen, L., Raulea, L., Xavier Lobo Mithun, E.: Vpdsl: A DSL for software in the loop simulations covering material flow. In: Proceedings of the 2012 IEEE 17th International Conference on Engineering of Complex Computer Systems, ICECCS ’12, pp. 318–327. IEEE Computer Society, USA (2012)
Verriet, J., Liang, H.L., Hamberg, R., van Wijngaarden, B.: Model-driven development of logistic systems using domain-specific tooling. In: Aiguier, M., Caseau, Y., Krob, D., Rauzy, A. (eds.), Complex Systems Design & Management, pp. 165–176. Springer, Berlin, Heidelberg (2013)
Gabbrielli, M., Martini, S.: How to Describe a Programming Language, pp. 27–55. Springer London, London (2010)
Dmitriev, S.: Language Oriented Programming: The Next Programming Paradigm. Technical report, Jetbrains, 2004
Campagne, F., Campagne, F.: The MPS Language Workbench, Vol. 1, 1st edn. CreateSpace Independent Publishing Platform, North Charleston, SC, USA (2014)
CWI-SWAT.: Syntax definition (2020)
Donzeau-Gouge, V., Huet, G., Lang, B., Kahn, G.: Programming environments based on structured editors: the mentor experience. Interact Program Environ (1984)
Vysokỳ, P., ParÃzek, P., Pech, V.: Ingrid: Creating languages in MPS from ANTLR grammars (2018)
ANTLR.: https://www.antlr.org/
Wimmer, M., Kramler, G.: Bridging grammarware and modelware. In: International Conference on Model Driven Engineering Languages and Systems, pp. 159–168. Springer (2005)
Luis Cánovas Izquierdo, J., Cuadrado, J.S., Molina, J.G.: Gra2mol: A domain specific transformation language for bridging grammarware to modelware in software modernization. In: Workshop on Model-Driven Software Evolution, pp. 1–8 (2008)
Voelter, M., Szabó, T., Lisson, S., Kolb, B., Erdweg, S., Berger, T.: Efficient development of consistent projectional editors using grammar cells. In: Proceedings of the 2016 ACM SIGPLAN International Conference on Software Language Engineering, SLE 2016, pp. 28–40. Association for Computing Machinery, New York, NY, USA (2016)
Van de Vanter, M.L., Boshernitsan, M., Avenue, S.A.: Displaying and editing source code in software engineering environments (2000)
van den Brand, M., Visser, E.: Generation of formatters for context-free languages. ACM Trans. Software Eng. Methodol. (TOSEM) 5(1), 1–41 (1996)
De Jonge, M.: Pretty-printing for software reengineering. In: International Conference on Software Maintenance, 2002. Proceedings, pp. 550–559. IEEE (2002)
Rubin, L.F.: Syntax-directed pretty printing—a first step towards a syntax-directed editor. IEEE Trans. Software Eng. (2), 119–127 (1983)
Parr, T., Vinju, J.: Towards a universal code formatter through machine learning. In: Proceedings of the 2016 ACM SIGPLAN International Conference on Software Language Engineering, SLE 2016, pp. 137–151. Association for Computing Machinery, New York, NY, USA (2016)
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2021 The Author(s), under exclusive license to Springer Nature Switzerland AG
About this chapter
Cite this chapter
Merino, M.V., Bartels, J., Brand, M.v.d., Storm, T.v.d., Schindler, E. (2021). Projecting Textual Languages. In: Bucchiarone, A., Cicchetti, A., Ciccozzi, F., Pierantonio, A. (eds) Domain-Specific Languages in Practice. Springer, Cham. https://doi.org/10.1007/978-3-030-73758-0_7
Download citation
DOI: https://doi.org/10.1007/978-3-030-73758-0_7
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-030-73757-3
Online ISBN: 978-3-030-73758-0
eBook Packages: Computer ScienceComputer Science (R0)