Language Design and Implementation via the Combination of Embedding and Parsing

Conference paper
Part of the Communications in Computer and Information Science book series (CCIS, volume 457)


Language embedding is a method to implement a new language within the framework of an existing programming language. This method is known to speed up the development process compared to standalone languages using classical compiler technology. On the other hand, embedded languages may not be that convenient for the end-users as standalone ones with own concrete syntax. This paper describes a method that uses the flexibility of language embedding in the experimental phase of the language design process, then, once the language features are mature enough, adds concrete syntax and turns the language to a standalone one. Lessons learnt from a project, run in industry-university cooperation and using the presented method, are discussed. Based on these results, a cost model is established that can be used to estimate the potential benefits of this method in case of future language design projects.


Domain specific languages Embedding Parsing Concrete syntax 



We would like to thank the support of Ericsson Hungary and the grant EITKIC 12-1-2012-0001 that is supported by the Hungarian Government, managed by the National Development Agency, and financed by the Research and Technology Innovation Fund.


  1. 1.
    Axelsson, E., Claessen, K., Dévai, G., Horváth, Z., Keijzer, K., Persson, A., Sheeran, M., Svenningsson, J., Vajda, A., et al.: Feldspar: a domain specific language for digital signal processing algorithms. In: Proceedings of the 8th ACM/IEEE International Conference on Formal Methods and Models for Codesign. IEEE (2010)Google Scholar
  2. 2.
    Bierhoff, K., Liongosari, E.S., Swaminathan, K.S.: Incremental development of a domain-specific language that supports multiple application styles. In: OOPSLA 6th Workshop on Domain Specific Modeling, pp. 67–78 (2006)Google Scholar
  3. 3.
    Bravenboer, M., de Groot, R., Visser, E.: MetaBorg in action: examples of domain-specific language embedding and assimilation using Stratego/XT. In: Lämmel, R., Saraiva, J., Visser, J. (eds.) GTTSE 2005. LNCS, vol. 4143, pp. 297–311. Springer, Heidelberg (2006)Google Scholar
  4. 4.
    Bravenboer, M., Visser, E.: Concrete syntax for objects: domain-specific language embedding and assimilation without restrictions. SIGPLAN Not. 39(10), 365–383 (2004).
  5. 5.
    Cleenewerck, T.: Component-based DSL development. In: Pfenning, F., Macko, M. (eds.) GPCE 2003. LNCS, vol. 2830, pp. 245–264. Springer, Heidelberg (2003)Google Scholar
  6. 6.
    Cunningham, H.C.: A little language for surveys: constructing an internal DSL in Ruby. In: Proceedings of the 46th Annual Southeast Regional Conference on XX. ACM-SE 46, pp. 282–287. ACM, New York (2008).
  7. 7.
    Czarnecki, K., O’Donnell, J.T., Striegnitz, J., Taha, W.: DSL implementation in MetaOCaml, Template Haskell, and C++. In: Lengauer, C., Batory, D., Blum, A., Odersky, M. (eds.) Domain-Specific Program Generation. LNCS, vol. 3016, pp. 51–72. Springer, Heidelberg (2004)Google Scholar
  8. 8.
    Dévai, G., Tejfel, M., Gera, Z., Páli, G., Nagy, G., Horváth, Z., Axelsson, E., Sheeran, M., Vajda, A., Lyckegård, B., Persson, A.: Efficient code generation from the high-level domain-specific language Feldspar for DSPs. In: ODES-8: 8th Workshop on Optimizations for DSP and Embedded Systems (2010)Google Scholar
  9. 9.
    Freeman, S., Pryce, N.: Evolving an embedded domain-specific language in Java. In: Companion to the 21st ACM SIGPLAN Conference. OOPSLA’06, pp. 855–865, Portland, Oregon, USA (2006).
  10. 10.
    Leijen, D., Meijer, E.: Parsec: Direct style monadic parser combinators for the real world. Electron. Notes Theoret. Comput. Sci. 41(1) (2001). Technical Report UU-CS-2001-35Google Scholar
  11. 11.
    Sloane, A.M.: Experiences with domain-specific language embedding in Scala. In: Lawall, J., Réveillére, L. (eds.) International Workshop on Domain-Specific Program Development (DSDP), Nashville, Tennessee, USA. vol. 7 (2008)Google Scholar
  12. 12.
    Spinellis, D.: Notable design patterns for domain-specific languages. J. Syst. Softw. 56(1), 91–99 (2001).
  13. 13.
    Wadler, P.: Wadler’s “Law” on language design. Haskell mailing list (1992).
  14. 14.
    Wile, D.: Lessons learned from real DSL experiments. Sci. Comput. Program. 51(3), 265–290 (2004).
  15. 15.
    Zdun, U.: A DSL toolkit for deferring architectural decisions in DSL-based software design. Inf. Softw. Technol. 52(7), 733–748 (2010).

Copyright information

© Springer-Verlag Berlin Heidelberg 2014

Authors and Affiliations

  1. 1.Faculty of InformaticsEötvös Loránd UniversityBudapestHungary

Personalised recommendations