Skip to main content

Projecting Textual Languages

  • Chapter
  • First Online:
Domain-Specific Languages in Practice

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.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 129.00
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 169.00
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info
Hardcover Book
USD 169.99
Price excludes VAT (USA)
  • Durable hardcover edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 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)

    Google Scholar 

  2. Lämmel, R.: The Notion of a Software Language, pp. 1–49. Springer International Publishing, Cham (2018)

    Google Scholar 

  3. Fowler, M.: Language workbenches: The killer-app for domain specific languages? (2015)

    Google Scholar 

  4. Mernik, M., Heering, J., Sloane, A.M.: When and how to develop domain-specific languages. ACM Comput. Surv. (CSUR) 37(4), 316–344 (2005)

    Google Scholar 

  5. 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)

    Google Scholar 

  6. Bartels, J.: Bridging the worlds of textual and projectional language workbenches. Master’s thesis, Eindhoven University of Technology, 1 2020

    Google Scholar 

  7. 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)

    Google Scholar 

  8. van Deursen, A., Klint, P., Visser, J.: Domain-specific languages: An annotated bibliography. SIGPLAN Not. 35(6), 26–36 (2000)

    Article  Google Scholar 

  9. Krueger, C.W.: Software reuse. ACM Comput. Surv. 24(2), 131–183 (1992)

    Article  Google Scholar 

  10. 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)

    Google Scholar 

  11. 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)

    Google Scholar 

  12. Gabbrielli, M., Martini, S.: How to Describe a Programming Language, pp. 27–55. Springer London, London (2010)

    Google Scholar 

  13. Dmitriev, S.: Language Oriented Programming: The Next Programming Paradigm. Technical report, Jetbrains, 2004

    Google Scholar 

  14. Campagne, F., Campagne, F.: The MPS Language Workbench, Vol. 1, 1st edn. CreateSpace Independent Publishing Platform, North Charleston, SC, USA (2014)

    Google Scholar 

  15. CWI-SWAT.: Syntax definition (2020)

    Google Scholar 

  16. Donzeau-Gouge, V., Huet, G., Lang, B., Kahn, G.: Programming environments based on structured editors: the mentor experience. Interact Program Environ (1984)

    Google Scholar 

  17. Vysokỳ, P., Parízek, P., Pech, V.: Ingrid: Creating languages in MPS from ANTLR grammars (2018)

    Google Scholar 

  18. ANTLR.: https://www.antlr.org/

  19. Wimmer, M., Kramler, G.: Bridging grammarware and modelware. In: International Conference on Model Driven Engineering Languages and Systems, pp. 159–168. Springer (2005)

    Google Scholar 

  20. 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)

    Google Scholar 

  21. 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)

    Google Scholar 

  22. Van de Vanter, M.L., Boshernitsan, M., Avenue, S.A.: Displaying and editing source code in software engineering environments (2000)

    Google Scholar 

  23. van den Brand, M., Visser, E.: Generation of formatters for context-free languages. ACM Trans. Software Eng. Methodol. (TOSEM) 5(1), 1–41 (1996)

    Google Scholar 

  24. De Jonge, M.: Pretty-printing for software reengineering. In: International Conference on Software Maintenance, 2002. Proceedings, pp. 550–559. IEEE (2002)

    Google Scholar 

  25. Rubin, L.F.: Syntax-directed pretty printing—a first step towards a syntax-directed editor. IEEE Trans. Software Eng. (2), 119–127 (1983)

    Article  Google Scholar 

  26. 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)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Mauricio Verano Merino .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2021 The Author(s), under exclusive license to Springer Nature Switzerland AG

About this chapter

Check for updates. Verify currency and authenticity via CrossMark

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)

Publish with us

Policies and ethics