skip to main content
research-article

Modular domain-specific language components in scala

Published:10 October 2010Publication History
Skip Abstract Section

Abstract

Programs in domain-­specific embedded languages (DSELs) can be represented in the host language in different ways, for instance implicitly as libraries, or explicitly in the form of abstract syntax trees. Each of these representations has its own strengths and weaknesses. The implicit approach has good composability properties, whereas the explicit approach allows more freedom in making syntactic program transformations.

Traditional designs for DSELs fix the form of representation, which means that it is not possible to choose the best representation for a particular interpretation or transformation. We propose a new design for implementing DSELs in Scala which makes it easy to use different program representations at the same time. It enables the DSL implementor to define modular language components and to compose transformations and interpretations for them.

References

  1. }}A. W. Appel and T. Jim. Shrinking lambda expressions in linear time. Journal of Functional Programming, 7(5):515--540, 1997. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. }}R. Atkey, S. Lindley, and J. Yallop. Unembedding domain­specific languages. In Haskell Symposium, pages 37--48, 2009. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. }}C. BÜ ohm and A. Berarducci. Automatic synthesis of typed lambda­ programs on term algebras. Theor. Comput. Sci., 39:135--154, 1985.Google ScholarGoogle ScholarCross RefCross Ref
  4. }}M. Bravenboer and E. Visser. Concrete syntax for objects: domain­ specific language embedding and assimilation without restrictions. In OOPSLA '04, pages 365--383, 2004. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. }}P. Buchlovsky and H. Thielecke. A type­theoretic reconstruction of the visitor pattern. In 21st Annual Conference on Mathematical Foundations of Programming Semantics, ENTCS 155, pages 309--329, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. }}J. Carette, O. Kiselyov, and C. chieh Shan. Finally tagless, partially evaluated: Tagless staged interpreters for simpler typed languages. Journal of Functional Programming, 19(5):509--543, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. }}N. G. de Bruijn. Lambda calculus notation with nameless dummies, a tool for automatic formula manipulation, with application to the Church­Rosser theorem. Indagationes Mathematicae, 34(5):381--392, 1972.Google ScholarGoogle ScholarCross RefCross Ref
  8. }}C. Elliott, S. Finne, and O. de Moor. Compiling embedded languages. Journal of Functional Programming, 13(3):455--481, 2003. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. }}D. A. Espinosa. Semantic Lego. PhD thesis, Columbia University, New York, NY, 1995. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. }}L. Fegaras and T. Sheard. Revisiting catamorphisms over datatypes with embedded functions. In POPL '96, pages 284--294, 1996. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. }}C. Hofer, K. Ostermann, T. Rendel, and A. Moors. Polymorphic embedding of DSLs. In GPCE '08, pages 137--148, 2008. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. }}P. Hudak. Modular domain specific languages and tools. In ICSR '98, pages 134--142. IEEE Computer Society, 1998. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. }}S. C. Kleene. A theory of positive integers in formal logic. part i. American Journal of Mathematics, 57(1):153--173, 1935.Google ScholarGoogle ScholarCross RefCross Ref
  14. }}T. Æ. Mogensen. Self­applicable online partial evaluation of the pure lambda calculus. In Symposium on Partial Evaluation and Semantics­ Based Program Manipulation, pages 39--44, 1995. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. }}E. Moggi. A modular approach to denotational semantics. In Category Theory and Computer Science '91, LNCS 530, pages 138--139, 1991. Springer. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. }}A. Moors, F. Piessens, and M. Odersky. Generics of a higher kind. In OOPSLA '08, pages 423--438, 2008. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. }}A. Nanevski. Meta­programming with names and necessity. In ICFP '02, pages 206--217, 2002. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. }}B. C. d. S. Oliveira. Genericity, extensibility and type­safety in the Visitor pattern. PhD thesis, Oxford University Computing Laboratory, Oxford, England, 2007.Google ScholarGoogle Scholar
  19. }}B. C. d. S. Oliveira. Modular visitor components. In ECOOP '09, LNCS 5653, pages 269--293, 2009. Springer. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. }}B. C. d. S. Oliveira, R. Hinze, and A. LÜ oh. Extensible and modular generics for the masses. In Trends in Functional Programming, Vol­ ume 7, pages 199--216, 2006. Intellect Books.Google ScholarGoogle Scholar
  21. }}B. C. d. S. Oliveira, M. Wang, and J. Gibbons. The visitor pattern as a reusable, generic, type­safe component. In OOPSLA '08, pages 439--456, 2008. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. }}M. Parigot. Recursive programming with proofs. Theor. Comput. Sci., 94(2):335--336, 1992. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. }}F. Pfenning and C. Elliott. Higher­order abstract syntax. In PLDI '88, pages 199--208, 1988. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. }}F. Pfenning and P. Lee. Metacircularity in the polymorphic lambda­ calculus. Theor. Comput. Sci., 89(1):137--159, 1991. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. }}T. Rendel, K. Ostermann, and C. Hofer. Typed self­representation. In PLDI '09, pages 293--303, 2009. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. }}J. C. Reynolds. User­defined types and procedural data as complemen­ tary approaches to data abstraction. In New Directions in Algorithmic Languages, IFIP Working Group 2.1 on Algol. INRIA, 1975.Google ScholarGoogle Scholar
  27. }}C. SchÜ urmann, J. Despeyroux, and F. Pfenning. Primitive recursion for higher­order abstract syntax. Theor. Comput. Sci., 266(1­2):1--57, 2001. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. }}A. M. Sloane. Experiences with domain­specific language embedding in scala. In 2nd International Workshop on Domain­Specific Program Development, Oct. 2008.Google ScholarGoogle Scholar
  29. }}A. Stump. Directly reflective meta­programming. Higher­Order and Symbolic Computation, 2010. To appear. Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. }}M. Torgersen. The expression problem revisited. In ECOOP '04, LNCS 3086, pages 123--143, 2004. Springer.Google ScholarGoogle ScholarCross RefCross Ref
  31. }}E. Van Wyk, L. Krishnan, D. Bodin, and A. Schwerdfeger. Attribute grammar­based language extensions for Java. In ECOOP '07, LNCS 4609, pages 575--599, 2007. Springer. Google ScholarGoogle ScholarDigital LibraryDigital Library
  32. }}P. Wadler. Expression problem, Java Genericity Mailing List, 12 November 1998. http://homepages.inf.ed.ac.uk/wadler/ papers/expression/expression.txt.Google ScholarGoogle Scholar
  33. }}G. Washburn and S. Weirich. Boxes go bananas: Encoding higher­ order abstract syntax with parametric polymorphism. Journal of Func­ tional Programming, 18(1):87--140, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  34. }}M. Zenger and M. Odersky. Independently extensible solutions to the expression problem. In 12th International Workshop on Foundations of Object­Oriented Languages, 2005.Google ScholarGoogle Scholar
  35. }}M. Zenger and M. Odersky. Extensible algebraic datatypes with defaults. In ICFP'01, pages 241--252, 2001. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Modular domain-specific language components in scala

          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 SIGPLAN Notices
            ACM SIGPLAN Notices  Volume 46, Issue 2
            GPCE '10
            Febuary 2011
            185 pages
            ISSN:0362-1340
            EISSN:1558-1160
            DOI:10.1145/1942788
            Issue’s Table of Contents
            • cover image ACM Conferences
              GPCE '10: Proceedings of the ninth international conference on Generative programming and component engineering
              October 2010
              198 pages
              ISBN:9781450301541
              DOI:10.1145/1868294
              • General Chair:
              • Eelco Visser,
              • Program Chair:
              • Jaakko Järvi

            Copyright © 2010 ACM

            Publisher

            Association for Computing Machinery

            New York, NY, United States

            Publication History

            • Published: 10 October 2010

            Check for updates

            Qualifiers

            • research-article

          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!