Skip to main content

The EDSL’s Struggle for Their Sources

  • Chapter
  • First Online:
Central European Functional Programming School (CEFP 2013)

Part of the book series: Lecture Notes in Computer Science ((LNTCS,volume 8606))

Included in the following conference series:

Abstract

Embedded Domain Specific Languages make language design and implementation easier, because lexical and syntactical analysis and part of the semantic checks can be completed by the compiler of the host language.

On the other hand, by the nature of embedding, EDSL compilers have to work with a syntax tree that stores no information about the source file processed and the location of the program entities within the source file. This makes it hard to produce user-friendly error messages and connect the generated target code with the source code for debugging and profiling purposes.

This lecture note presents this problem in detail and shows possible solutions. The first, lightweight solution uses macro preprocessing. The second one is based on syntax tree transformations to add missing source-related information. This is more powerful, but also more heavyweight. The last technique avoids the problem by turning the embedded language implementation to a standalone one (with own parser) after the experimental phase of the language development process: It turns out that most of the embedded implementation can be reused in the standalone one.

Supported by EITKIC 12-1-2012-0001.

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 39.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight 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

Notes

  1. 1.

    In this project we have been using Subversion.

  2. 2.

    Note that this project was entirely implemented in Haskell, which allows much more concise code than the mainstream imperative, object oriented languages.

  3. 3.

    We have been using the Parsec parser combinator library [12] of Haskell. Using context free grammars instead would have resulted in similar code size.

  4. 4.

    “Wadler’s Law: The emotional intensity of debate on a language feature increases as one moves down the following scale: Semantics, Syntax, Lexical syntax, Comments.” (Philiph Wadler in the Haskell mailing list, February 1992, see [18].).

References

  1. cpphs: Haskell implementation of the C preprocessor. http://projects.haskell.org/cpphs/

  2. Axelsson, E., Claessen, K., Dévai, G., Horváth, Z., Keijzer, K., Lyckegård, B., Persson, A., Sheeran, M., Svenningsson, J., Vajdax, A.: Feldspar: a domain specific language for digital signal processing algorithms. In: 2010 8th IEEE/ACM International Conference on Formal Methods and Models for Codesign (MEMOCODE), pp. 169–178. IEEE (2010)

    Google Scholar 

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

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

    Chapter  Google Scholar 

  5. Bravenboer, M., Visser, E.: Concrete syntax for objects: domain-specific language embedding and assimilation without restrictions. SIGPLAN Not. 39(10), 365–383 (2004)

    Article  Google Scholar 

  6. Cleenewerck, T.: Component-based DSL development. In: Pfenning, F., Macko, M. (eds.) GPCE 2003. LNCS, vol. 2830, pp. 245–264. Springer, Heidelberg (2003)

    Chapter  Google Scholar 

  7. Dévai, G.: Embedding a proof system in haskell. In: Horváth, Z., Plasmeijer, R., Zsók, V. (eds.) CEFP 2009. LNCS, vol. 6299, pp. 354–371. Springer, Heidelberg (2010)

    Chapter  Google Scholar 

  8. Dévai, G., Tejfel, M., Gera, Z., Páli, G., Gyula Nagy, Horváth, Z., Axelsson, E., Sheeran, M., Vajda, A., Lyckegård, B., et al.: 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. Dévai, G., Tejfel, M., Leskó, D.: Embedding and parsing combined for efficient language design (accepted for publication at icsoft-ea) (2013)

    Google Scholar 

  10. Elliott, C., Finne, S., De Moor, O.: Compiling embedded languages. J. Funct. Program. 13(3), 455–481 (2003)

    Article  MATH  Google Scholar 

  11. Hudak, P.: Building domain-specific embedded languages. ACM Comput. Surv. 28(4es), 196 (1996)

    Article  Google Scholar 

  12. Leijen, D., Meijer, E.: Parsec: direct style monadic parser combinators for the real world. Electron. Notes Theor. Comput. Sci. 41(1) (2001)

    Google Scholar 

  13. Miller, H., Burmako, E., Haller, P.: Reflection. http://docs.scala-lang.org/overviews/reflection/overview.html

  14. Spinellis, D.: Notable design patterns for domain-specific languages. J. Syst. Softw. 56(1), 91–99 (2001)

    Article  Google Scholar 

  15. Svensson, J.: Obsidian source code repository. https://github.com/svenssonjoel/Obsidian

  16. Svensson, J., Sheeran, M., Claessen, K.: Obsidian: a domain specific embedded language for parallel programming of graphics processors. In: Scholz, S.-B., Chitil, O. (eds.) IFL 2008. LNCS, vol. 5836, pp. 156–173. Springer, Heidelberg (2011)

    Chapter  Google Scholar 

  17. Tratt, L.: Domain specific language implementation via compile-time meta-programming. ACM Trans. Program. Lang. Syst. (TOPLAS) 30(6), 31 (2008)

    Article  Google Scholar 

  18. Wadler, P.: Wadler’s “Law” on language design. Haskell mailing list (1992). http://code.haskell.org/~dons/haskell-1990-2000/msg00737.html

  19. Wile, D.: Lessons learned from real dsl experiments. Sci. Comput. Program. 51(3), 265–290 (2004)

    Article  MathSciNet  Google Scholar 

  20. Zdun, U.: A dsl toolkit for deferring architectural decisions in dsl-based software design. Inf. Softw. Technol. 52(7), 733–748 (2010)

    Article  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Gergely Dévai .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2015 Springer International Publishing Switzerland

About this chapter

Cite this chapter

Dévai, G., Leskó, D., Tejfel, M. (2015). The EDSL’s Struggle for Their Sources. In: Zsók, V., Horváth, Z., Csató, L. (eds) Central European Functional Programming School. CEFP 2013. Lecture Notes in Computer Science(), vol 8606. Springer, Cham. https://doi.org/10.1007/978-3-319-15940-9_7

Download citation

  • DOI: https://doi.org/10.1007/978-3-319-15940-9_7

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-319-15939-3

  • Online ISBN: 978-3-319-15940-9

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics