skip to main content
research-article
Free Access

Domain specific language implementation via compile-time meta-programming

Published:30 October 2008Publication History
Skip Abstract Section

Abstract

Domain specific languages (DSLs) are mini-languages that are increasingly seen as being a valuable tool for software developers and non-developers alike. DSLs must currently be created in an ad-hoc fashion, often leading to high development costs and implementations of variable quality. In this article, I show how expressive DSLs can be hygienically embedded in the Converge programming language using its compile-time meta-programming facility, the concept of DSL blocks, and specialised error reporting techniques. By making use of pre-existing facilities, and following a simple methodology, DSL implementation costs can be significantly reduced whilst leading to higher quality DSL implementations.

References

  1. Abadi, M. and Cardelli, L. 1996. A Theory of Objects. Springer-Verlag, New York. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. Aycock, J. and Horspool, R. N. 2002. Practical Earley parsing. The Computer Journal 45, 6, 620--630.Google ScholarGoogle ScholarCross RefCross Ref
  3. Bachrach, J. and Playford, K. 1999. D-expressions: Lisp power, Dylan style. http://www.ai.mit.edu/people/jrb/Projects/dexprs.pdf Accessed Nov 22 2006.Google ScholarGoogle Scholar
  4. Bachrach, J. and Playford, K. 2001. The Java syntactic extender (JSE). In Proceedings of the 14th Annual Conference on Object-Oriented Programming Systems, Languages, and Applications (OOPSLA'99) (Denver, CO). ACM, New York, 31--42. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. Brabrand, C. and Schwartzbach, M. 2000. Growing languages with metamorphic syntax macros. In Proceedings of the Workshop on Partial Evaluation and Semantics-Based Program Manipulation. SIGPLAN. ACM, New York. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. Bravenboer, M. and Visser, E. 2004. Concrete syntax for objects. Domain-specific language embedding and assimilation without restrictions. In Proceedings of the 19th Annual Conference on Object-Oriented Programming Systems, Languages, and Applications (OOPSLA'04) (Vancouver, BC, Canada). ACM, New York. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. Cointe, P. 1987. Metaclasses are first class: The ObjVLisp model. In Proceedings of the ACM Conference on Object-Oriented Programming Systems Languages and Applications (OOPSLA'87). ACM, New York, 156--162. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. Cordy, J. R. 2004. TXL—A language for programming language tools and applications. In Proceedings of the ACM 4th International Workshop on Language Descriptions, Tools and Applications. ACM, New York. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. Czarnecki, K., O'Donnell, J., Striegnitz, J., and Taha, W. 2004. DSL implementation in MetaOCaml, Template Haskell, and C++. 3016, 50--71.Google ScholarGoogle Scholar
  10. Dybvig, R. K., Hieb, R., and Bruggeman, C. 1992. Syntactic abstraction in scheme. In Lisp and Symb. Comput. 5. 295--326. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. Earley, J. 1970. An efficient context-free parsing algorithm. Commun. ACM 13, 2 (Feb.). Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. Fleutot, F. and Tratt, L. 2007. Contrasting compile-time meta-programming in Metalua and Converge. In Proceedings of the Workshop on Dynamic Languages and Applications.Google ScholarGoogle Scholar
  13. Goldberg, A. and Robson, D. 1989. Smalltalk-80: The Language. Addison-Wesley, Reading, MA. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. Grimm, R. 2005. Systems need languages need systems! 2nd ECOOP Workshop on Programming Languages and Operating Systems.Google ScholarGoogle Scholar
  15. Griswold, R. E. and Griswold, M. T. 1996. The Icon Programming Language, Third ed. Peer-to-Peer Communications. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. Hudak, P. 1998. Modular domain specific languages and tools. In Proceedings of the 5th International Conference on Software Reuse. 134--142. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. Kohlbecker, E., Friedman, D. P., Felleisen, M., and Duba, B. 1986. Hygienic macro expansion. In Proceedings of the Symposium on Lisp and Functional Programming. ACM, New York, 151--161. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. Mernik, M., Heering, J., and Sloane, A. M. 2003. When and how to develop domain-specific languages. Tech. rep., Centrum voor Wiskundeen Informatica. Dec.Google ScholarGoogle Scholar
  19. Schröer, F. W. 2005. The ACCENT Grammar Language. http://accent.compilertools.net/language.html Accessed Jan 25 2005.Google ScholarGoogle Scholar
  20. Seefried, S., Chakravarty, M., and Keller, G. 2004. Optimising embedded DSLs using template Haskell. In Proceedings of the 3rd International Conference on Generative Programming and Component Engineering (Vancouver, BC Canada). Springer-Verlag, New York, 186--205.Google ScholarGoogle Scholar
  21. Sheard, T. 1998. Using MetaML: A staged programming language. Adv. Funct. Prog., 207--239.Google ScholarGoogle Scholar
  22. Sheard, T. 2003. Accomplishments and research challenges in meta-programming. Proceedings of the Workshop on Semantics, Applications and Implementation of Program Generation (SAIG '01) 2196, 2--44. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. Sheard, T., el Abidine Benaissa, Z., and Pasalic, E. 1999. DSL implementation using staging and monads. In Proceedings of the 2nd Conference on Domain Specific Languages. SIGPLAN, vol. 35. ACM, New York, 81--94. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. Sheard, T. and Jones, S. P. 2002. Template meta-programming for Haskell. In Proceedings of the Haskell Workshop 2002. ACM, New York. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. Skalski, K., Moskal, M., and Olszta, P. 2004. Meta-programming in Nemerle. http://nemerle.org/metaprogramming.pdf. Accessed Nov 5 2007.Google ScholarGoogle Scholar
  26. Steele, Jr, G. L. 1999. Growing a language. Higher-Order and Symbolic Computation 12, 3 (Oct.), 221--236. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. Tratt, L. 2005a. Compile-time meta-programming in a dynamically typed OO language. In Proceedings of the Dynamic Languages Symposium. 49--64. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. Tratt, L. 2005b. The Converge programming language. Tech. Rep. TR-05-01, Department of Computer Science, King's College London.Google ScholarGoogle Scholar
  29. Tratt, L. 2005c. The MT model transformation language. Tech. Rep. TR-05-02, Department of Computer Science, King's College London. May.Google ScholarGoogle Scholar
  30. Tratt, L. 2007. Converge Reference Manual. http://www.convergepl.org/documentation/Accessed June 3 2008.Google ScholarGoogle Scholar
  31. van den Brand, M. G. J., Heering, J., Klint, P., and Olivier, P. A. 2002. Compiling language definitions: the asf+sdf compiler. ACM Trans. Program. Lang. Syst. 24, 4, 334--368. Google ScholarGoogle ScholarDigital LibraryDigital Library
  32. van Deursen, A., Klint, P., and Visser, J. 2000. Domain-specific languages: An annotated bibliography. SIGPLAN Notices, 35, 26--36. Google ScholarGoogle ScholarDigital LibraryDigital Library
  33. van Rossum, G. 2003. Python 2.3 reference manual. http://www.python.org/doc/2.3/ref/ref.html Accessed June 3 2008.Google ScholarGoogle Scholar
  34. Walker, K. 1994. The run-time implementation language for Icon. Tech. Rep. IPD261, University of Arizona.Google ScholarGoogle Scholar
  35. Weise, D. and Crew, R. 1993. Programmable syntax macros. In Proceedings of the SIGPLAN. ACM, New York, 156--165. Google ScholarGoogle ScholarDigital LibraryDigital Library
  36. Wilson, G. V. 2005. Extensible programming for the 21st century. Queue 2, 9 (Jan.), 48--57. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Domain specific language implementation via compile-time meta-programming

    Recommendations

    Comments

    Login options

    Check if you have access through your login credentials or your institution to get full access on this article.

    Sign in

    Full Access

    • Published in

      cover image ACM Transactions on Programming Languages and Systems
      ACM Transactions on Programming Languages and Systems  Volume 30, Issue 6
      October 2008
      245 pages
      ISSN:0164-0925
      EISSN:1558-4593
      DOI:10.1145/1391956
      Issue’s Table of Contents

      Copyright © 2008 ACM

      Publisher

      Association for Computing Machinery

      New York, NY, United States

      Publication History

      • Published: 30 October 2008
      • Accepted: 1 January 2008
      • Revised: 1 January 2007
      • Received: 1 February 2006
      Published in toplas Volume 30, Issue 6

      Permissions

      Request permissions about this article.

      Request Permissions

      Check for updates

      Qualifiers

      • research-article
      • Research
      • Refereed

    PDF Format

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader
    About Cookies On This Site

    We use cookies to ensure that we give you the best experience on our website.

    Learn more

    Got it!