skip to main content
article

Concrete syntax for objects: domain-specific language embedding and assimilation without restrictions

Published:01 October 2004Publication History
Skip Abstract Section

Abstract

Application programmer's interfaces give access to domain knowledge encapsulated in class libraries without providing the appropriate notation for expressing domain composition. Since object-oriented languages are designed for extensibility and reuse, the language constructs are often sufficient for expressing domain abstractions at the semantic level. However, they do not provide the right abstractions at the syntactic level. In this paper we describe MetaBorg, a method for providing <i>concrete syntax</i> for domain abstractions to application programmers. The method consists of <i>embedding</i> domain-specific languages in a general purpose host language and <i>assimilating</i> the embedded domain code into the surrounding host code. Instead of extending the implementation of the host language, the assimilation phase implements domain abstractions in terms of existing APIs leaving the host language undisturbed. Indeed, MetaBorg can be considered a method for promoting APIs to the language level. The method is supported by proven and available technology, i.e. the syntax definition formalism SDF and the program transformation language and toolset Stratego/XT. We illustrate the method with applications in three domains: code generation, XML generation, and user-interface construction.

References

  1. J. Bachrach and K. Playford. The Java syntactic extender (JSE). In Proceedings of the 16th ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA'01), pages 31--42. ACM Press, 2001. See also http://jse.sourceforge.net/.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. D. Batory, B. Lofaso, and Y. Smaragdakis. JTS: tools for implementing domain-specific languages. In Proceedings Fifth International Conference on Software Reuse (ICSR'98), pages 143--153. IEEE Computer Society, June 1998. See also http://www.cs.utexas.edu/users/schwartz/software.html.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. A. Begel and S. L. Graham. Language analysis and tools for input stream ambiguities. In Proceedings of the Fourth Workshop on Language Descriptions, Tools and Applications (LDTA'04), Electronic Notes in Theoretical Computer Science, Barcelona, Spain, April 2004. Elsevier.]]Google ScholarGoogle Scholar
  4. F. Bouma. LLBLGen Pro, the n-tier generator and O/R mapper for .NET. http://www.llblgen.com.]]Google ScholarGoogle Scholar
  5. R. Bourret. XML data binding resources. http://www.rpbourret.com/xml/XMLDataBinding.htm.]]Google ScholarGoogle Scholar
  6. C. Brabrand and M. I. Schwartzbach. Growing languages with metamorphic syntax macros. In Proceedings of the 2002 ACM SIGPLAN Workshop on Partial Evaluation and Semantics-based Program Manipulation (PEPM'02), pages 31--40. ACM Press, 2002.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. C. Brabrand, M. I. Schwartzbach, and M. Vanggaard. The Metafront system: Extensible parsing and transformation. In Proceedings of the Third Workshop on Language Descriptions, Tools and Applications (LDTA'03), volume~82 of Electronic Notes in Theoretical Computer Science. Elsevier, December 2003. See also http://www.brics.dk/metafront/.]]Google ScholarGoogle ScholarCross RefCross Ref
  8. M. G. J. Brandvan den Brand, H. de Jong, P. Klint, and P. Olivier. Efficient annotated terms. Software, Practice & Experience, 30(3):259--291, 2000.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. M. G. J. Brandvan den Brand, J. Heering, H. de Jong, M. de Jonge, T. Kuipers, P. Klint, L. Moonen, P. Olivier, J. Scheerder, J. Vinju, E. Visser, and J. Visser. The Asf+Sdf Meta-Environment: a component-based language laboratory. In R. Wilhelm, editor, Compiler Construction (CC'01), volume 2027 of Lecture Notes in Computer Science, pages 365--368, Genova, Italy, April 2001. Springer-Verlag.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. M. G. J. Brandvan den Brand, J. Scheerder, J. Vinju, and E. Visser. Disambiguation filters for scannerless generalized LR parsers. In N. Horspool, editor, Compiler Construction (CC'02), volume 2304 of Lecture Notes in Computer Science, pages 143--158, Grenoble, France, April 2002. Springer-Verlag.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. Byte code engineering library (BCEL). http://jakarta.apache.org/bcel/.]]Google ScholarGoogle Scholar
  12. L. Cardelli. An implementation of F&lt;:- SRC Research Report 97, Digital Equipment Corporation, Systems Research Center, February 1993.]]Google ScholarGoogle Scholar
  13. L. Cardelli, F. Matthes, and M. Abadi. Extensible syntax with lexical scoping. SRC Research Report 121, Digital Equipment Corporation, Systems Research Center, February 1994.]]Google ScholarGoogle Scholar
  14. Castor databinding framework for java. http://www.castor.org.]]Google ScholarGoogle Scholar
  15. The Apache Cocoon project. http://cocoon.apache.org/.]]Google ScholarGoogle Scholar
  16. H. de Jong and P. Olivier. Generation of abstract programming interfaces from syntax definitions. Journal of Logic and Algebraic Programming, 59(1-2):35--61, April-May 2004. See also http://www.cwi.nl/htbin/sen1/twiki/bin/view/SEN1/ApiGen.]]Google ScholarGoogle ScholarCross RefCross Ref
  17. A. Deursenvan~Deursen, J. Heering, and P. Klint, editors. Language Prototyping. An Algebraic Specification Approach, volume 5 of AMAST Series in Computing. World Scientific, Singapore, September 1996.]]Google ScholarGoogle ScholarCross RefCross Ref
  18. J. Earley. An efficient context-free parsing algorithm. Communications of the ACM, 13(2):94--102, 1970.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. B. Fischer and E. Visser. Retrofitting the AutoBayes program synthesis system with concrete object syntax. In C. Lengauer et al., editors, Domain-Specific Program Generation, volume 3016 of Lecture Notes in Computer Science, pages 239--253. Spinger-Verlag, 2004.]]Google ScholarGoogle ScholarCross RefCross Ref
  20. E. M. Gagnon and L. J. Hendren. SableCC, an object-oriented compiler framework. In Proceedings of the Technology of Object-Oriented Languages and Systems (TOOLS'98), pages 140--154. IEEE Computer Society, 1998. See also http://www.sablecc.org.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. J. Heering, P. R. H. Hendriks, P. Klint, and J. Rekers. The syntax definition formalism SDF -- reference manual. SIGPLAN Notices, 24(11):43--75, 1989.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. H. Hosoya and B. C. Pierce. XDuce: A typed XML processing language. In The World Wide Web and Databases, Third International Workshop WebDB 2000, Selected Papers, volume 1997 of Lecture Notes in Computer Science, pages 226--244. Springer-Verlag, 2000.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. P. Hudak. Building domain-specific embedded languages. ACM Computing Surveys, 28(4es), December 1996.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. Java Compiler Compiler (JavaCC). https://javacc.dev.java.net/.]]Google ScholarGoogle Scholar
  25. Java architecture for XML binding JAXB. http://java.sun.com/xml/jaxb/.]]Google ScholarGoogle Scholar
  26. M. Jongede Jonge, E. Visser, and J. Visser. XT: A bundle of program transformation tools. In M. G. J. van den Brand and D. Perigot, editors, Workshop on Language Descriptions, Tools and Applications (LDTA'01), volume 44 of Electronic Notes in Theoretical Computer Science. Elsevier Science Publishers, April 2001.]]Google ScholarGoogle Scholar
  27. G. Kirby, R. Morrison, and D. Stemple. Linguistic reflection in Java. Software - Practice & Experience, 28(10):1045--1077, 1998.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. T. Kuipers and J. Visser. Object-oriented tree traversal with JJForester. In M. G. J. van den Brand and D. Perigot, editors, Proceedings of Workshop on Language Descriptions, Tools and Applications (LDTA'01), volume 44 of Electronic Notes in Theoretical Computer Science. Elsevier Science Publishers, 2001.]]Google ScholarGoogle ScholarCross RefCross Ref
  29. D. Lea. Concurrent Programming in Java, Second Edition, Design Principles and Patterns. Addison Wesley Longman Publishing Co., Inc., 2000.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. B. M. Leavenworth. Syntax macros and extended translation. Communications of the ACM, 9(11):790--793, November 1966.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. E. Meijer and W. Schulte. Programming with rectangles, triangles, and circles. In Proceedings of XML Conference & Exposition 2003 (XML 2003). IDEAlliance, December 2003.]]Google ScholarGoogle Scholar
  32. E. Meijer and W. Schulte. Unifying tables, objects, and documents. In Proceedings of the Workshop on Declarative Programming in the Context of Object-Oriented Languages (DP-COOL'03), August 2003.]]Google ScholarGoogle Scholar
  33. M. Mernik, J. Heering, and A. M. Sloane. When and how to develop domain-specific languages. Submitted to ACM Computing Surveys, 2003.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  34. ASF+SDF MetaEnvironment website. http://www.cwi.nl/projects/MetaEnv/.]]Google ScholarGoogle Scholar
  35. P.-E. Moreau, C. Ringeissen, and M. Vittek. A pattern matching compiler for multiple target languages. In G. Hedin, editor, 12th Conference on Compiler Construction (CC'03), volume 2622, pages 61--76, Warsaw, Poland, 2003. Springer-Verlag. See also http://tom.loria.fr.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  36. J. Rekers. Parser Generation for Interactive Environments. PhD thesis, University of Amsterdam, 1992.]]Google ScholarGoogle Scholar
  37. D. J. Salomon and G. V. Cormack. Scannerless NSLR(1) parsing of programming languages. ACM SIGPLAN Notices, 24(7):170--178, 1989. Proceedings of the ACM SIGPLAN 1989 Conference on Programming Language Design and Implementation (PLDI'89).]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  38. http://www.syntax-definition.org.]]Google ScholarGoogle Scholar
  39. A. Shalit. The Dylan reference manual: the definitive guide to the new object-oriented dynamic language. Addison Wesley Longman Publishing Co., Inc., 1996.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  40. Y. Smaragdakis and D. Batory. Application generators. Encyclopedia of Electrical and Electronics Engineering, 2000. J.G. Webster (ed.), John Wiley and Sons.]]Google ScholarGoogle Scholar
  41. http://www.stratego-language.org.]]Google ScholarGoogle Scholar
  42. K. Tao, W. Wang, and J. Palsberg. Java Tree Builder (JTB). http://www.cs.purdue.edu/jtb/.]]Google ScholarGoogle Scholar
  43. M. Tomita. Efficient Parsing for Natural Languages. A Fast Algorithm for Practical Systems. Kluwer Academic Publishers, 1985.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  44. E. Visser. Scannerless generalized-LR parsing. Technical Report P9707, Programming Research Group, University of Amsterdam, July 1997.]]Google ScholarGoogle Scholar
  45. E. Visser. Syntax Definition for Language Prototyping. PhD thesis, University of Amsterdam, September 1997.]]Google ScholarGoogle Scholar
  46. E. Visser. Meta-programming with concrete object syntax. In D. Batory, C. Consel, and W. Taha, editors, Generative Programming and Component Engineering (GPCE'02), volume 2487 of Lecture Notes in Computer Science, pages 299--315, Pittsburgh, PA, USA, October 2002. Springer-Verlag.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  47. E. Visser. Program transformation with Stratego/XT: Rules, strategies, tools, and systems in StrategoXT-0.9. In C. Lengauer et al., editors, Domain-Specific Program Generation, volume 3016 of Lecture Notes in Computer Science, pages 216--238. Spinger-Verlag, June 2004.]]Google ScholarGoogle ScholarCross RefCross Ref
  48. E. Visser, Z.-e.-A. Benaissa, and A. Tolmach. Building program optimizers with rewriting strategies. In Proceedings of the third ACM SIGPLAN International Conference on Functional Programming (ICFP'98), pages 13--26. ACM Press, September 1998.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  49. J. Visser. Visitor combination and traversal control. In Proceedings of the 16th ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA'01), pages 270--282. ACM Press, 2001.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  50. D. Weise and R. Crew. Programmable syntax macros. In Proceedings of the ACM SIGPLAN 1993 conference on Programming language design and implementation (PLDI'93), pages 156--165. ACM Press, 1993.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  51. The Xtatic project: Native XML processing for C#. http://www.cis.upenn.edu/~bcpierce/xtatic/.]]Google ScholarGoogle Scholar

Index Terms

  1. Concrete syntax for objects: domain-specific language embedding and assimilation without restrictions

    Recommendations

    Reviews

    Matthew Mark Huntbach

    This paper describes the combined use of several tools for programming language manipulation, collectively given the name MetaBorg. This collection enables the syntax of a programming language to be extended. Although examples are given in Java, the tools are not specific to Java. The language extensions need to be described by a grammar that makes reference to elements of the host language, and by transformation rules that are used to translate the extended code into pure code for the host language. One example given is a simple language, for building graphical user interfaces, that incorporates Java expressions. Expressions in this language may be translated to standard Java code using MetaBorg. The complete translation requires the use of SDF (a syntax definition formalism), SGLR (a parser), and Stratego (a program transformation system), all described further in other papers that are referenced. I found the paper to be a little hard to follow because of the variety of tools used, none of which are fully described. It seems that the authors' intention was to offer a taste of the power of the system, while encouraging the interested reader to seek out further references. Several examples are included, but I think it might have been better to keep to one example, and describe it in more detail. As the paper suggests, the technique described would be useful in specialist domains where standard programming languages alone would result in unwieldy code, but it would be impractical to develop new specialist languages from scratch. Online Computing Reviews Service

    Access critical reviews of Computing literature here

    Become a reviewer for Computing Reviews.

    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 39, Issue 10
      OOPSLA '04
      October 2004
      448 pages
      ISSN:0362-1340
      EISSN:1558-1160
      DOI:10.1145/1035292
      Issue’s Table of Contents
      • cover image ACM Conferences
        OOPSLA '04: Proceedings of the 19th annual ACM SIGPLAN conference on Object-oriented programming, systems, languages, and applications
        October 2004
        462 pages
        ISBN:1581138318
        DOI:10.1145/1028976

      Copyright © 2004 ACM

      Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

      Publisher

      Association for Computing Machinery

      New York, NY, United States

      Publication History

      • Published: 1 October 2004

      Check for updates

      Qualifiers

      • article

    PDF Format

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader