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.
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- 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 Scholar
- F. Bouma. LLBLGen Pro, the n-tier generator and O/R mapper for .NET. http://www.llblgen.com.]]Google Scholar
- R. Bourret. XML data binding resources. http://www.rpbourret.com/xml/XMLDataBinding.htm.]]Google Scholar
- 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 ScholarDigital Library
- 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 ScholarCross Ref
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- Byte code engineering library (BCEL). http://jakarta.apache.org/bcel/.]]Google Scholar
- L. Cardelli. An implementation of F<:- SRC Research Report 97, Digital Equipment Corporation, Systems Research Center, February 1993.]]Google Scholar
- 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 Scholar
- Castor databinding framework for java. http://www.castor.org.]]Google Scholar
- The Apache Cocoon project. http://cocoon.apache.org/.]]Google Scholar
- 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 ScholarCross Ref
- 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 ScholarCross Ref
- J. Earley. An efficient context-free parsing algorithm. Communications of the ACM, 13(2):94--102, 1970.]] Google ScholarDigital Library
- 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 ScholarCross Ref
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- P. Hudak. Building domain-specific embedded languages. ACM Computing Surveys, 28(4es), December 1996.]] Google ScholarDigital Library
- Java Compiler Compiler (JavaCC). https://javacc.dev.java.net/.]]Google Scholar
- Java architecture for XML binding JAXB. http://java.sun.com/xml/jaxb/.]]Google Scholar
- 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 Scholar
- G. Kirby, R. Morrison, and D. Stemple. Linguistic reflection in Java. Software - Practice & Experience, 28(10):1045--1077, 1998.]] Google ScholarDigital Library
- 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 ScholarCross Ref
- D. Lea. Concurrent Programming in Java, Second Edition, Design Principles and Patterns. Addison Wesley Longman Publishing Co., Inc., 2000.]] Google ScholarDigital Library
- B. M. Leavenworth. Syntax macros and extended translation. Communications of the ACM, 9(11):790--793, November 1966.]] Google ScholarDigital Library
- E. Meijer and W. Schulte. Programming with rectangles, triangles, and circles. In Proceedings of XML Conference & Exposition 2003 (XML 2003). IDEAlliance, December 2003.]]Google Scholar
- 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 Scholar
- M. Mernik, J. Heering, and A. M. Sloane. When and how to develop domain-specific languages. Submitted to ACM Computing Surveys, 2003.]] Google ScholarDigital Library
- ASF+SDF MetaEnvironment website. http://www.cwi.nl/projects/MetaEnv/.]]Google Scholar
- 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 ScholarDigital Library
- J. Rekers. Parser Generation for Interactive Environments. PhD thesis, University of Amsterdam, 1992.]]Google Scholar
- 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 ScholarDigital Library
- http://www.syntax-definition.org.]]Google Scholar
- A. Shalit. The Dylan reference manual: the definitive guide to the new object-oriented dynamic language. Addison Wesley Longman Publishing Co., Inc., 1996.]] Google ScholarDigital Library
- Y. Smaragdakis and D. Batory. Application generators. Encyclopedia of Electrical and Electronics Engineering, 2000. J.G. Webster (ed.), John Wiley and Sons.]]Google Scholar
- http://www.stratego-language.org.]]Google Scholar
- K. Tao, W. Wang, and J. Palsberg. Java Tree Builder (JTB). http://www.cs.purdue.edu/jtb/.]]Google Scholar
- M. Tomita. Efficient Parsing for Natural Languages. A Fast Algorithm for Practical Systems. Kluwer Academic Publishers, 1985.]] Google ScholarDigital Library
- E. Visser. Scannerless generalized-LR parsing. Technical Report P9707, Programming Research Group, University of Amsterdam, July 1997.]]Google Scholar
- E. Visser. Syntax Definition for Language Prototyping. PhD thesis, University of Amsterdam, September 1997.]]Google Scholar
- 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 ScholarDigital Library
- 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 ScholarCross Ref
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- The Xtatic project: Native XML processing for C#. http://www.cis.upenn.edu/~bcpierce/xtatic/.]]Google Scholar
Index Terms
Concrete syntax for objects: domain-specific language embedding and assimilation without restrictions
Recommendations
The spoofax language workbench: rules for declarative specification of languages and IDEs
OOPSLA '10: Proceedings of the ACM international conference on Object oriented programming systems languages and applicationsSpoofax is a language workbench for efficient, agile development of textual domain-specific languages with state-of-the-art IDE support. Spoofax integrates language processing techniques for parser generation, meta-programming, and IDE development into ...
Concrete syntax for objects: domain-specific language embedding and assimilation without restrictions
OOPSLA '04: Proceedings of the 19th annual ACM SIGPLAN conference on Object-oriented programming, systems, languages, and applicationsApplication 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, ...
Assimilating MetaBorg:: embedding language tools in languages
GPCE '06: Proceedings of the 5th international conference on Generative programming and component engineeringThe MetaBorg usage pattern allows concrete syntax to be associated with application programmer interfaces (API's). Once a concrete syntax is defined, library writers use the Stratego language to write transformations from the concrete syntax to API data ...
Comments