Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
skip to main content
10.1145/2048066.2048137acmconferencesArticle/Chapter ViewAbstractPublication PagessplashConference Proceedingsconference-collections
research-article

Backstage Java: making a difference in metaprogramming

Published: 22 October 2011 Publication History

Abstract

We propose Backstage Java (BSJ), a Java language extension which allows algorithmic, contextually-aware generation and transformation of code. BSJ explicitly and concisely represents design patterns and other encodings by employing compile-time metaprogramming: a practice in which the programmer writes instructions which are executed over the program's AST during compilation. While compile-time metaprogramming has been successfully used in functional languages such as Template Haskell, a number of language properties (scope, syntactic structure, mutation, etc.) have thus far prevented this theory from translating to the imperative world. BSJ uses the novel approach of difference-based metaprogramming to provide an imperative programming style amenable to the Java community and to enforce that metaprograms are consistent and semantically unambiguous. To make the feasibility of BSJ metaprogramming evident, we have developed a compiler implementation and numerous working code examples.

References

[1]
J. Baker and W. C. Hsieh. Maya: Multiple-dispatch syntax extension in Java. In phPLDI, pages 270--281, 2002.
[2]
D. Batory, B. Lofaso, and Y. Smaragdakis. JTS: Tools for implementing domain-specific languages. Software Reuse, International Conference on, 0: 143, 1998.
[3]
M. Bravenboer, R. Vermaas, J. Vinju, and E. Visser. Generalized type-based disambiguation of meta programs with concrete object syntax. In Proceedings of the Fourth International Conference on Generative Programming and Component Engineering (GPCE'05), volume 3676 of Lecture Notes in Computer Science, pages 157--172. Springer, 2005.
[4]
S. Chiba. A metaobject protocol for C+, 1995.
[5]
Codehaus Foundation. Groovy - building AST guide, May 2010. http://groovy.codehaus.org/BuildingASTGuide.
[6]
E. Gamma, R. Helm, R. Johnson, and J. M. Vlissides. Design Patterns: Elements of Reusable Object-Oriented Software. Addison-Wesley Professional, 1 edition, November 1994.
[7]
S. E. Ganz, A. Sabry, and W. Taha. Macros as multi-stage computations: Type-safe, generative, binding macros in MacroML. In MacroML. In the International Conference on Functional Programming (ICFP '01, pages 74--85. ACM Press, 2001.
[8]
J. Gosling, B. Joy, G. Steele, and G. Bracha. The Java Language Specification, Third Edition. Addison-Wesley Longman, Amsterdam, 3 edition, June 2005.
[9]
S. S. Huang, D. Zook, and Y. Smaragdakis. Domain-specific languages and program generation with Meta-AspectJ. ACM Trans. Softw. Eng. Methodol., 18: 6:1--6:32, November 2008.
[10]
S. Kamin, L. Clausen, and A. Jarvis. Jumbo: Run-time code generation for Java and its applications. In CGO '03: Proceedings of the international symposium on Code generation and optimization, pages 48--56, Washington, DC, USA, 2003. IEEE Computer Society.
[11]
E. Lippe and N. van Oosterom. Operation-based merging. SIGSOFT Softw. Eng. Notes, 17: 78--87, November 1992.
[12]
T. Mens. A state-of-the-art survey on software merging. IEEE Trans. Softw. Eng., 28: 449--462, May 2002.
[13]
Z. Palmer and S. F. Smith. Backstage Java: Making a difference in metaprogramming. OOPSLA '11, 2011. ACM Digital Library supplemental material.
[14]
T. J. Parr and R. W. Quong. Adding semantic and syntactic predicates to LL(k): pred-LL(k). In Computational Complexity, pages 263--277. Springer-Verlag, 1994.
[15]
D. J. Quinlan. ROSE: Compiler support for object-oriented frameworks. Parallel Processing Letters, 10 (2/3): 215--226, 2000.
[16]
A. D. Robison. Impact of economics on compiler optimization. In Proceedings of the 2001 joint ACM-ISCOPE conference on Java Grande, JGI '01, pages 1--10, New York, NY, USA, 2001. ACM.
[17]
T. Sheard. Accomplishments and research challenges in meta-programming. In SAIG 2001: Proceedings of the Second International Workshop on Semantics, Applications, and Implementation of Program Generation, pages 2--44, London, UK, 2001. Springer-Verlag.
[18]
T. Sheard and S. P. Jones. Template meta-programming for Haskell. In ACM SIGPLAN Haskell Workshop 02, pages 1--16. ACM Press, 2002.
[19]
W. Taha and phet. al. MetaOCaml: A compiled, type-safe multi-stage programming language. http://www.metaocaml.org/.
[20]
W. Taha and T. Sheard. MetaML and multi-stage programming with explicit annotations. Theor. Comput. Sci., 248 (1--2): 211--242, 2000.
[21]
M. Tatsubori and S. Chiba. Programming support of design patterns with compile-time reflection, 1998.
[22]
L. Tratt. Compile-time meta-programming in a dynamically typed oo language. In Proceedings of the 2005 symposium on Dynamic languages, DLS '05, pages 49--63, New York, NY, USA, 2005. ACM.
[23]
T. L. Veldhuizen. C+ templates are turing complete. Technical report, 2003.
[24]
T. L. Veldhuizen. Tradeoffs in metaprogramming. In PEPM '06: Proceedings of the 2006 ACM SIGPLAN symposium on Partial evaluation and semantics-based program manipulation, pages 150--159, New York, NY, USA, 2006. ACM.
[25]
E. Visser. Program transformation with Stratego/XT: Rules, strategies, tools, and systems in StrategoXT 0.9, 2004.
[26]
D. von Dincklage. Making patterns explicit with metaprogramming. In GPCE '03: Proceedings of the 2nd international conference on Generative programming and component engineering, pages 287--306, New York, NY, USA, 2003. Springer-Verlag New York, Inc.
[27]
E. Westbrook, M. Ricken, J. Inoue, Y. Yao, T. Abdelatif, and W. Taha. Mint: Java multi-stage programming using weak separability. In ACM SIGPLAN 2010 Conference on Programming Language Design and Implementation (PLDI '10), June 2010.

Cited By

View all
  • (2019)A Survey of Metaprogramming LanguagesACM Computing Surveys10.1145/335458452:6(1-39)Online publication date: 16-Oct-2019
  • (2014)Safely Composable Type-Specific LanguagesProceedings of the 28th European Conference on ECOOP 2014 --- Object-Oriented Programming - Volume 858610.1007/978-3-662-44202-9_5(105-130)Online publication date: 1-Aug-2014
  • (2013)Type-directed, whitespace-delimited parsing for embedded DSLsProceedings of the First Workshop on the Globalization of Domain Specific Languages10.1145/2489812.2489815(8-11)Online publication date: 1-Jul-2013
  • Show More Cited By

Index Terms

  1. Backstage Java: making a difference in metaprogramming

    Recommendations

    Comments

    Information & Contributors

    Information

    Published In

    cover image ACM Conferences
    OOPSLA '11: Proceedings of the 2011 ACM international conference on Object oriented programming systems languages and applications
    October 2011
    1104 pages
    ISBN:9781450309400
    DOI:10.1145/2048066
    • cover image ACM SIGPLAN Notices
      ACM SIGPLAN Notices  Volume 46, Issue 10
      OOPSLA '11
      October 2011
      1063 pages
      ISSN:0362-1340
      EISSN:1558-1160
      DOI:10.1145/2076021
      Issue’s Table of Contents
    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]

    Sponsors

    Publisher

    Association for Computing Machinery

    New York, NY, United States

    Publication History

    Published: 22 October 2011

    Permissions

    Request permissions for this article.

    Check for updates

    Author Tags

    1. Java
    2. design patterns
    3. difference-based metaprogramming
    4. macros
    5. metaprogramming
    6. software merging

    Qualifiers

    • Research-article

    Conference

    SPLASH '11
    Sponsor:

    Acceptance Rates

    Overall Acceptance Rate 268 of 1,244 submissions, 22%

    Upcoming Conference

    Contributors

    Other Metrics

    Bibliometrics & Citations

    Bibliometrics

    Article Metrics

    • Downloads (Last 12 months)5
    • Downloads (Last 6 weeks)0
    Reflects downloads up to 25 Dec 2024

    Other Metrics

    Citations

    Cited By

    View all
    • (2019)A Survey of Metaprogramming LanguagesACM Computing Surveys10.1145/335458452:6(1-39)Online publication date: 16-Oct-2019
    • (2014)Safely Composable Type-Specific LanguagesProceedings of the 28th European Conference on ECOOP 2014 --- Object-Oriented Programming - Volume 858610.1007/978-3-662-44202-9_5(105-130)Online publication date: 1-Aug-2014
    • (2013)Type-directed, whitespace-delimited parsing for embedded DSLsProceedings of the First Workshop on the Globalization of Domain Specific Languages10.1145/2489812.2489815(8-11)Online publication date: 1-Jul-2013
    • (2011)Backstage JavaACM SIGPLAN Notices10.1145/2076021.204813746:10(939-958)Online publication date: 22-Oct-2011

    View Options

    Login options

    View options

    PDF

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader

    Media

    Figures

    Other

    Tables

    Share

    Share

    Share this Publication link

    Share on social media