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.
- }}A. W. Appel and T. Jim. Shrinking lambda expressions in linear time. Journal of Functional Programming, 7(5):515--540, 1997. Google Scholar
Digital Library
- }}R. Atkey, S. Lindley, and J. Yallop. Unembedding domainspecific languages. In Haskell Symposium, pages 37--48, 2009. ACM. Google Scholar
Digital Library
- }}C. BÜ ohm and A. Berarducci. Automatic synthesis of typed lambda programs on term algebras. Theor. Comput. Sci., 39:135--154, 1985.Google Scholar
Cross Ref
- }}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 Scholar
Digital Library
- }}P. Buchlovsky and H. Thielecke. A typetheoretic reconstruction of the visitor pattern. In 21st Annual Conference on Mathematical Foundations of Programming Semantics, ENTCS 155, pages 309--329, 2006. Google Scholar
Digital Library
- }}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 Scholar
Digital Library
- }}N. G. de Bruijn. Lambda calculus notation with nameless dummies, a tool for automatic formula manipulation, with application to the ChurchRosser theorem. Indagationes Mathematicae, 34(5):381--392, 1972.Google Scholar
Cross Ref
- }}C. Elliott, S. Finne, and O. de Moor. Compiling embedded languages. Journal of Functional Programming, 13(3):455--481, 2003. Google Scholar
Digital Library
- }}D. A. Espinosa. Semantic Lego. PhD thesis, Columbia University, New York, NY, 1995. Google Scholar
Digital Library
- }}L. Fegaras and T. Sheard. Revisiting catamorphisms over datatypes with embedded functions. In POPL '96, pages 284--294, 1996. ACM. Google Scholar
Digital Library
- }}C. Hofer, K. Ostermann, T. Rendel, and A. Moors. Polymorphic embedding of DSLs. In GPCE '08, pages 137--148, 2008. ACM. Google Scholar
Digital Library
- }}P. Hudak. Modular domain specific languages and tools. In ICSR '98, pages 134--142. IEEE Computer Society, 1998. Google Scholar
Digital Library
- }}S. C. Kleene. A theory of positive integers in formal logic. part i. American Journal of Mathematics, 57(1):153--173, 1935.Google Scholar
Cross Ref
- }}T. Æ. Mogensen. Selfapplicable online partial evaluation of the pure lambda calculus. In Symposium on Partial Evaluation and Semantics Based Program Manipulation, pages 39--44, 1995. ACM. Google Scholar
Digital Library
- }}E. Moggi. A modular approach to denotational semantics. In Category Theory and Computer Science '91, LNCS 530, pages 138--139, 1991. Springer. Google Scholar
Digital Library
- }}A. Moors, F. Piessens, and M. Odersky. Generics of a higher kind. In OOPSLA '08, pages 423--438, 2008. ACM. Google Scholar
Digital Library
- }}A. Nanevski. Metaprogramming with names and necessity. In ICFP '02, pages 206--217, 2002. ACM. Google Scholar
Digital Library
- }}B. C. d. S. Oliveira. Genericity, extensibility and typesafety in the Visitor pattern. PhD thesis, Oxford University Computing Laboratory, Oxford, England, 2007.Google Scholar
- }}B. C. d. S. Oliveira. Modular visitor components. In ECOOP '09, LNCS 5653, pages 269--293, 2009. Springer. Google Scholar
Digital Library
- }}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 Scholar
- }}B. C. d. S. Oliveira, M. Wang, and J. Gibbons. The visitor pattern as a reusable, generic, typesafe component. In OOPSLA '08, pages 439--456, 2008. ACM. Google Scholar
Digital Library
- }}M. Parigot. Recursive programming with proofs. Theor. Comput. Sci., 94(2):335--336, 1992. Google Scholar
Digital Library
- }}F. Pfenning and C. Elliott. Higherorder abstract syntax. In PLDI '88, pages 199--208, 1988. ACM. Google Scholar
Digital Library
- }}F. Pfenning and P. Lee. Metacircularity in the polymorphic lambda calculus. Theor. Comput. Sci., 89(1):137--159, 1991. Google Scholar
Digital Library
- }}T. Rendel, K. Ostermann, and C. Hofer. Typed selfrepresentation. In PLDI '09, pages 293--303, 2009. ACM. Google Scholar
Digital Library
- }}J. C. Reynolds. Userdefined 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 Scholar
- }}C. SchÜ urmann, J. Despeyroux, and F. Pfenning. Primitive recursion for higherorder abstract syntax. Theor. Comput. Sci., 266(12):1--57, 2001. Google Scholar
Digital Library
- }}A. M. Sloane. Experiences with domainspecific language embedding in scala. In 2nd International Workshop on DomainSpecific Program Development, Oct. 2008.Google Scholar
- }}A. Stump. Directly reflective metaprogramming. HigherOrder and Symbolic Computation, 2010. To appear. Google Scholar
Digital Library
- }}M. Torgersen. The expression problem revisited. In ECOOP '04, LNCS 3086, pages 123--143, 2004. Springer.Google Scholar
Cross Ref
- }}E. Van Wyk, L. Krishnan, D. Bodin, and A. Schwerdfeger. Attribute grammarbased language extensions for Java. In ECOOP '07, LNCS 4609, pages 575--599, 2007. Springer. Google Scholar
Digital Library
- }}P. Wadler. Expression problem, Java Genericity Mailing List, 12 November 1998. http://homepages.inf.ed.ac.uk/wadler/ papers/expression/expression.txt.Google Scholar
- }}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 Scholar
Digital Library
- }}M. Zenger and M. Odersky. Independently extensible solutions to the expression problem. In 12th International Workshop on Foundations of ObjectOriented Languages, 2005.Google Scholar
- }}M. Zenger and M. Odersky. Extensible algebraic datatypes with defaults. In ICFP'01, pages 241--252, 2001. ACM. Google Scholar
Digital Library
Index Terms
Modular domain-specific language components in scala
Recommendations
Modular domain-specific language components in scala
GPCE '10: Proceedings of the ninth international conference on Generative programming and component engineeringPrograms 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 ...
Development of internal domain-specific languages: design principles and design patterns
PLoP '11: Proceedings of the 18th Conference on Pattern Languages of ProgramsA great part of software development challenges can be solved by one universal tool: Abstraction. Developers solve development challenges by using expressions and concepts that abstract from too technical details. One especially supportive tool for ...
Scala macros: let our powers combine!: on how rich syntax and static types work with metaprogramming
SCALA '13: Proceedings of the 4th Workshop on ScalaCompile-time metaprogramming has been proven immensely useful enabling programming techniques such as language virtualization, embedding of external domain-specific languages, self-optimization, and boilerplate generation among many others.
In the ...







Comments