skip to main content
10.1145/1289971.1289977acmconferencesArticle/Chapter ViewAbstractPublication PagesgpceConference Proceedingsconference-collections
Article

Repleo: a syntax-safe template engine

Published:01 October 2007Publication History

ABSTRACT

Templates are a very common solution to generate code. They are used for different tasks like rendering webpages, creating Java Beans and so on. Most template systems have no notion of the object language and just generate text. The drawback of this approach is the possibility to generate syntactical incorrect code. This can lead to all kinds of annoying errors.

In this paper we present an approach for a syntax safe template engine. Syntax safety guarantees that the generated code can be correctly parsed. To ensure this we use the object language grammar to evaluate the template.

References

  1. M. G. J. van den Brand, H. A. de Jong, P. Klint, and P. A. Olivier. Efficient annotated terms. Softw. Pract. Exper., 30(3):259--291, 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. M. G. J. van den Brand and P. Klint. ASF+SDF Meta-Environment User Manual.Google ScholarGoogle Scholar
  3. M. Bravenboer, R. de Groot, and E. Visser. Metaborg in action: Examples of domain-specific language embedding and assimilation using stratego/xt. In GTTSE '05: Proceedings of the Summer School on Generative and Transformational Techniques in Software Engineering, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. J. Clark, S. DeRose, et al. XML Path Language (XPath) Version 1.0. W3C Recommendation, 16:1999, 1999.Google ScholarGoogle Scholar
  5. Object Management Group. MOF model to text transformation language rfp. OMG Document ad/2004-04-07 (2004).Google ScholarGoogle Scholar
  6. Object Management Group. Unified modeling language: Super-structure-version 2.0-final adopted specification. 2005.Google ScholarGoogle Scholar
  7. 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
  8. J. Herrington. Code Generation in Action. Manning Publications, 2003. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. S. S. Huang, D. Zook, and Y. Smaragdakis. Statically safe program generation with SafeGen. In R. Glück and M. Lowry, editors, Generative Programming and Component Engineering (GPCE 2005), volume 3676 of Lecture Notes in Computer Science, pages 309--326. Springer-Verlag, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. R. Johnson and J. Hoeller. Expert One-on-One J2EE Development without EJB. John Wiley & Sons, 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. H. A. de Jong and P. A. Olivier. Generation of abstract programming interfaces from syntax definitions. Journal of Logic and Algebraic Programming, 59(1-2):35--61, 2004.Google ScholarGoogle ScholarCross RefCross Ref
  12. P. Klint, R. Lämmel, and C. Verhoef. Toward an engineering discipline for grammarware. ACM Transactions on Software Engineering Methodology, 14(3):331--380, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. E. Kohlbecker, D. P. Friedman, M. Felleisen, and B. Duba. Hygienic macro expansion. In LFP '86: Proceedings of the 1986 ACM conference on LISP and functional programming, pages 151--161, New York, NY, USA, 1986. ACM Press. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. D. Leijen and E. Meijer. Domain specific embedded compilers. In PLAN '99: Proceedings of the 2nd conference on Domain-specific languages, pages 109--122, New York, NY, USA, 1999. ACM Press. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. L. Moonen. Generating robust parsers using island grammars. In Proceedings of the 8th Working Conference on Reverse Engineering, pages 13--22. IEEE Computer Society Press, oct 2001. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. T. J. Parr. Enforcing strict model-view separation in template engines. In WWW '04: Proceedings of the 13th international conference on World Wide Web, pages 224--233, New York, NY, USA, 2004. ACM Press. Google ScholarGoogle ScholarDigital LibraryDigital Library
  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. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. R. Soley and the OMG Staff Strategy Group. Model-driven architecture. November 2000.Google ScholarGoogle Scholar
  19. W. Taha and T. Sheard. MetaML and multi-stage programming with explicit annotations. Technical report, 1999. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. M. G. J. van den Brand, P. Klint, and J. J. Vinju. Term rewriting with traversal functions. ACM Trans. Softw. Eng. Methodol., 12(2):152--190, 2003. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. J. J. Vinju. Analysis and Transformation of Source Code by Parsing and Rewriting. PhD thesis, University of Amsterdam, 2005.Google ScholarGoogle Scholar
  22. E. Visser. Scannerless generalized-LR parsing. Technical Report P9707, Programming Research Group, Universiteit van Amsterdam, juli 1997.Google ScholarGoogle Scholar
  23. E. Visser. Meta-programming with concrete object syntax. In GPCE '02: Proceedings of the 1st ACM SIGPLAN/SIGSOFT conference on Generative Programming and Component Engineering, pages 299--315, London, UK, 2002. Springer-Verlag. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. 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 Scholar
  25. M. Völter and A. Gartner. Jenerator - generative programming for java. OOPSLA, October 2001.Google ScholarGoogle Scholar

Index Terms

  1. Repleo: a syntax-safe template engine

    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
    • Published in

      cover image ACM Conferences
      GPCE '07: Proceedings of the 6th international conference on Generative programming and component engineering
      October 2007
      206 pages
      ISBN:9781595938558
      DOI:10.1145/1289971

      Copyright © 2007 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 2007

      Permissions

      Request permissions about this article.

      Request Permissions

      Check for updates

      Qualifiers

      • Article

      Acceptance Rates

      Overall Acceptance Rate56of180submissions,31%

      Upcoming Conference

    PDF Format

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader