Embedding Languages without Breaking Tools

  • Lukas Renggli
  • Tudor Gîrba
  • Oscar Nierstrasz
Part of the Lecture Notes in Computer Science book series (LNCS, volume 6183)

Abstract

Domain-specific languages (DSLs) are increasingly used as embedded languages within general-purpose host languages. DSLs provide a compact, dedicated syntax for specifying parts of an application related to specialized domains. Unfortunately, such language extensions typically do not integrate well with the development tools of the host language. Editors, compilers and debuggers are either unaware of the extensions, or must be adapted at a non-trivial cost. We present a novel approach to embed DSLs into an existing host language by leveraging the underlying representation of the host language used by these tools. Helvetia is an extensible system that intercepts the compilation pipeline of the Smalltalk host language to seamlessly integrate language extensions. We validate our approach by case studies that demonstrate three fundamentally different ways to extend or adapt the host language syntax and semantics.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1.
    Fowler, M.: FluentInterface, on Martin Fowler’s blog (December 2005), http://www.martinfowler.com/bliki/FluentInterface.html
  2. 2.
    Fowler, M.: Language workbenches: The killer-app for domain-specific languages (June 2005), http://www.martinfowler.com/articles/languageWorkbench.html
  3. 3.
    Mernik, M., Heering, J., Sloane, A.M.: When and how to develop domain-specific languages. ACM Comput. Surv. 37(4), 316–344 (2005)CrossRefGoogle Scholar
  4. 4.
    Hudak, P.: Building domain specific embedded languages. ACM Computing Surveys 28(4es) (December 1996)Google Scholar
  5. 5.
    Spinellis, D.: Notable design patterns for domain specific languages. Journal of Systems and Software 56(1), 91–99 (2001)CrossRefGoogle Scholar
  6. 6.
    Renggli, L., Denker, M., Nierstrasz, O.: Language boxes: Bending the host language with modular language changes. In: Software Language Engineering: Second International Conference, SLE 2009, Denver, Colorado, October 5-6. LNCS. Springer, Heidelberg (2009) (to appear)Google Scholar
  7. 7.
    Sheard, T.: Accomplishments and research challenges in meta-programming. In: Taha, W. (ed.) SAIG 2001. LNCS, vol. 2196, pp. 2–44. Springer, Heidelberg (2001)CrossRefGoogle Scholar
  8. 8.
    Gybels, K., Wuyts, R., Ducasse, S., D’Hondt, M.: Inter-language reflection — a conceptual model and its implementation. Journal of Computer Languages, Systems and Structures 32(2-3), 109–124 (2006)MATHCrossRefGoogle Scholar
  9. 9.
    Van Wyk, E., Krishnan, L., Bodin, D., Schwerdfeger, A.: Attribute Grammar-Based Language Extensions for Java. In: Ernst, E. (ed.) ECOOP 2007. LNCS, vol. 4609, p. 575. Springer, Heidelberg (2007)CrossRefGoogle Scholar
  10. 10.
    Kats, L.C.L., Bravenboer, M., Visser, E.: Mixing source and bytecode. A case for compilation by normalization. In: Kiczales, G. (ed.) Proceedings OOPSLA 2008, Nashville, Tenessee, USA, pp. 91–108. ACM, New York (October 2008)Google Scholar
  11. 11.
    Ekman, T., Hedin, G.: The JastAdd extensible Java compiler. In: Gabriel, R.P., Bacon, D.F., Lopes, C.V., Steele Jr., G.L. (eds.) Proceedings OOPSLA 2007, pp. 1–18. ACM, New York (2007)CrossRefGoogle Scholar
  12. 12.
    Nystrom, N., Clarkson, M.R., Myers, A.C.: Polyglot: An extensible compiler framework for java. In: Hedin, G. (ed.) CC 2003. LNCS, vol. 2622, pp. 138–152. Springer, Heidelberg (2003)CrossRefGoogle Scholar
  13. 13.
    Cox, R., Bergan, T., Clements, A.T., Kaashoek, F., Kohler, E.: Xoc, an extension-oriented compiler for systems programming. SIGARCH Comput. Archit. News 36(1), 244–254 (2008)CrossRefGoogle Scholar
  14. 14.
    Piumarta, I., Warth, A.: Open reusable object models. Technical report, Viewpoints Research Institute, VPRI Research Note RN-2006-003-a (2006)Google Scholar
  15. 15.
    Warth, A., Piumarta, I.: OMeta: an object-oriented language for pattern matching. In: DLS 2007: Proceedings of the 2007 symposium on Dynamic languages, pp. 11–19. ACM, New York (2007)CrossRefGoogle Scholar
  16. 16.
    Tratt, L.: The Converge programming language. Technical Report TR-05-01, Department of Computer Science, King’s College London (February 2005)Google Scholar
  17. 17.
    Calcagno, C., Taha, W., Huang, L., Leroy, X.: Implementing multi-stage languages using ASTs, GenSym, and Reflection. In: Pfenning, F., Smaragdakis, Y. (eds.) GPCE 2003. LNCS, vol. 2830, pp. 57–76. Springer, Heidelberg (2003)Google Scholar
  18. 18.
    Dimitriev, S.: Language oriented programming: The next programming paradigm. On Board Online Magazine 1(1) (November 2004)Google Scholar
  19. 19.
    Simonyi, C., Christerson, M., Clifford, S.: Intentional software. In: Proceedings OOPSLA 2006, pp. 451–464. ACM, New York (2006)CrossRefGoogle Scholar
  20. 20.
    Solmi, R.: Whole Platform. PhD thesis, University of Bologna (March 2005)Google Scholar
  21. 21.
    Charles, P., Fuhrer, R.M., Sutton Jr., S.M., Duesterwald, E., Vinju, J.J.: Accelerating the creation of customized, language-specific ides in eclipse. In: Arora, S., Leavens, G.T. (eds.) Proceedings OOPSLA 2009, pp. 191–206. ACM, New York (2009)CrossRefGoogle Scholar
  22. 22.
    Seaton, C.: A programming language where the syntax and semantics are mutable at runtime. Technical Report CSTR-07-005, University of Bristol (June 2007)Google Scholar
  23. 23.
    Clark, T., Sammut, P., Willans, J.: Superlanguages, Developing Languages and Applications with XMF. 1st edn., Ceteva (2008)Google Scholar
  24. 24.
    Faith, R.E., Nyland, L.S., Prins, J.F.: KHEPERA: a system for rapid implementation of domain specific languages. In: DSL 1997: Proceedings of the Conference on Domain-Specific Languages on Conference on Domain-Specific Languages (DSL), p. 19. USENIX Association, Berkeley (1997)Google Scholar
  25. 25.
    Krahn, H., Rumpe, B., Völkel, S.: MontiCore: Modular development of textual domain specific languages. In: Paige, R., Meyer, B. (eds.) Proceedings of the 46th International Conference Objects, Models, Components, Patterns (TOOLS-Europe), pp. 297–315. Springer, Heidelberg (2008)Google Scholar
  26. 26.
    Parr, T.: The Definitive ANTLR Reference: Building Domain-Specific Languages. Pragmatic Programmers (May 2007)Google Scholar
  27. 27.
    Bravenboer, M., Visser, E.: Concrete syntax for objects. Domain-specific language embedding and assimilation without restrictions. In: Schmidt, D.C. (ed.) Proceedings OOPSLA 2004, Vancouver, Canada, pp. 365–383. ACM Press, New York (October 2004)Google Scholar
  28. 28.
    Visser, E.: Program transformation with Stratego/XT: Rules, strategies, tools, and systems in StrategoXT-0.9. In: Lengauer, C., Batory, D., Consel, C., Odersky, M. (eds.) Domain-Specific Program Generation. LNCS, vol. 3016, pp. 216–238. Springer, Heidelberg (2004)Google Scholar
  29. 29.
    Goldberg, A., Robson, D.: Smalltalk 80: the Language and its Implementation. Addison-Wesley, Reading (1983)MATHGoogle Scholar
  30. 30.
    Meyer, M., Gîrba, T., Lungu, M.: Mondrian: An agile visualization framework. In: ACM Symposium on Software Visualization (SoftVis 2006), pp. 135–144. ACM Press, New York (2006)CrossRefGoogle Scholar
  31. 31.
    Renggli, L., Nierstrasz, O.: Transactional memory in a dynamic language. Journal of Computer Languages, Systems and Structures 35(1), 21–30 (2009)CrossRefGoogle Scholar
  32. 32.
    Herlihy, M.P.: Wait-free synchronization. ACM Transactions on Programming Languages and Systems 13(1), 124–149 (1991)CrossRefGoogle Scholar
  33. 33.
    Herlihy, M.P., Moss, J.E.B.: Transactional memory: Architectural support for lock-free data structures. In: Proceedings of the 20th Annual International Symposium on Computer Architecture, pp. 289–300 (1993)Google Scholar
  34. 34.
    Roberts, D., Brant, J., Johnson, R.E.: A refactoring tool for Smalltalk. Theory and Practice of Object Systems (TAPOS) 3(4), 253–263 (1997)CrossRefGoogle Scholar
  35. 35.
    Futamura, Y.: Partial evaluation of computation process: An approach to a compiler-compiler. Higher Order Symbol. Comput. 12(4), 381–391 (1999)MATHCrossRefGoogle Scholar
  36. 36.
    Wirth, N.: What can we do about the unnecessary diversity of notation for syntactic definitions? ACM Commun. 20(11), 822–823 (1977)CrossRefGoogle Scholar
  37. 37.
    Bracha, G.: Executable grammars in Newspeak. Electron. Notes Theor. Comput. Sci. 193, 3–18 (2007)CrossRefGoogle Scholar
  38. 38.
    Tratt, L.: Domain specific language implementation via compile-time meta-programming. ACM TOPLAS 30(6), 1–40 (2008)CrossRefGoogle Scholar
  39. 39.
    Renggli, L., Gîrba, T.: Why Smalltalk wins the host languages shootout. In: Proceedings of International Workshop on Smalltalk Technologies (IWST 2009). ACM Digital Library, New York (2009) (to appear)Google Scholar
  40. 40.
    Bawden, A.: Quasiquotation in Lisp. In: Partial Evaluation and Semantic-Based Program Manipulation, pp. 4–12 (1999)Google Scholar
  41. 41.
    Taha, W.: A gentle introduction to multi-stage programming. In: Domain-Specific Program Generation, pp. 30–50 (2003)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2010

Authors and Affiliations

  • Lukas Renggli
    • 1
  • Tudor Gîrba
    • 1
  • Oscar Nierstrasz
    • 1
  1. 1.Software Composition GroupUniversity of BernSwitzerland

Personalised recommendations