Meta-programming with Concrete Object Syntax

  • Eelco Visser
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 2487)

Abstract

Meta programs manipulate structured representations, i.e., abstract syntax trees, of programs. The conceptual distance between the concrete syntax meta-programmers use to reason about programs and the notation for abstract syntax manipulation provided by general purpose (meta-) programming languages is too great for many applications. In this paper it is shown how the syntax definition formalism SDF can be employed to fit any meta-programming language with concrete syntax notation for composing and analyzing object programs. As a case study, the addition of concrete syntax to the program transformation language Stratego is presented. The approach is then generalized to arbitrary meta-languages.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1.
    A. Aasa. User Defined Syntax. PhD thesis, Dept. of Computer Sciences, Chalmers University of Technology and University of Göteborg, Göteborg, Sweden, 1992.Google Scholar
  2. 2.
    A. W. Appel. Modern Compiler Implementation in ML. Cambridge University Press, 1998.Google Scholar
  3. 3.
    D. Batory, B. Lofaso, and Y. Smaragdakis. JTS: A tool suite for building gen-voca generators. In 5th International Conference in Software Reuse, (ICSR’98), Victoria, Canada, June 1998.Google Scholar
  4. 4.
    J. A. Bergstra, J. Heering, and P. Klint, editors. Algebraic Specification. ACM Press Frontier Series. The ACM Press in co-operation with Addison-Wesley, 1989.Google Scholar
  5. 5.
    C. Brabrand and M. I. Schwartzbach. Growing languages with metamorphic syntax macros. In PEPM’02, 2002.Google Scholar
  6. 6.
    M. G. J. van den Brand, H. de Jong, P. Klint, and P. Olivier. Efficient annotated terms. Software, Practice & Experience, 30(3):259–291, 2000.CrossRefGoogle Scholar
  7. 7.
    M. G. J. van 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.CrossRefGoogle Scholar
  8. 8.
    M. G. J. van 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.CrossRefGoogle Scholar
  9. 9.
    M. G. J. van den Brand and E. Visser. Generation of formatters for context-free languages. ACM Transactions on Software Engineering and Methodology, 5(1):1–41, January 1996.Google Scholar
  10. 10.
    R. D. Cameron and M. R. Ito. Grammar-based definition of metaprogramming systems. ACM Trans. on Programming Languages and Systems, 6(1):20–54, 1984.MATHCrossRefGoogle Scholar
  11. 11.
    L. Cardelli, F. Matthes, and M. Abadi. Extensible syntax with lexical scoping. SRC Research Report 121, Digital Systems Research Center, Palo Alto, California, February 1994.Google Scholar
  12. 12.
    J. R. Cordy, C. D. Halpern, and E. Promislow. TXL: a rapid prototyping system for programming language dialects. In Proc. IEEE 1988 Int. Conf. on Computer Languages, pages 280–285, 1988.Google Scholar
  13. 13.
    A. van 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.MATHGoogle Scholar
  14. 14.
    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.CrossRefGoogle Scholar
  15. 15.
    M. de 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
  16. 16.
    P. Klint. A meta-environment for generating programming environments. ACM Transactions on Software Engineering and Methodology, 2(2):176–201, 1993.CrossRefGoogle Scholar
  17. 17.
    M. Mauny and D. de Rauglaudre. A complete and realistic implementation of quotations in ML. In Proc. 1994 Workshop on ML and its applications, pages 70–78. Research report 2265, INRIA, 1994.Google Scholar
  18. 18.
    S. Peyton Jones, A. Tolmach, and T. Hoare. Playing by the rules: rewriting as a practical optimisation technique in GHC. In R. Hinze, editor, 2001 Haskell Workshop, Firenze, Italy, September 2001. ACM SIGPLAN.Google Scholar
  19. 19.
    W. Taha. Multi-Stage Programming: Its Theory and Applications. PhD thesis, Oregon Graduate Institute of Science and Technology, 1999.Google Scholar
  20. 20.
    E. Visser. Syntax Definition for Language Prototyping. PhD thesis, University of Amsterdam, September 1997.Google Scholar
  21. 21.
    E. Visser. Stratego: A language for program transformation based on rewriting strategies. System description of Stratego 0.5. In A. Middeldorp, editor, Rewriting Techniques and Applications (RTA’ 01), volume 2051 of Lecture Notes in Computer Science, pages 357–361. Springer-Verlag, May 2001.CrossRefGoogle Scholar
  22. 22.
    E. Visser, Z.-e.-A. Benaissa, and A. Tolmach. Building program optimizers with rewriting strategies. In Proc. of the third ACM SIGPLAN International Conference on Functional Programming (ICFP’98), pages 13–26. ACM Press, September 1998.Google Scholar
  23. 23.
    D. Weise and R. F. Crew. Programmable syntax macros. In Proceedings of the ACM SIGPLAN’ 93 Conference on Programming Language Design and Implementation (PLDI’93), Albuquerque, New Mexico, June 1993.Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2002

Authors and Affiliations

  • Eelco Visser
    • 1
  1. 1.Institute of Information and Computing SciencesUniversiteit UtrechtTB UtrechtThe Netherlands

Personalised recommendations