Skip to main content

From Macros to Reusable Generative Programming

  • Conference paper
  • First Online:
Generative and Component-Based Software Engineering (GCSE 1999)

Part of the book series: Lecture Notes in Computer Science ((LNCS,volume 1799))

Abstract

Generative programming is widely used both to develop new programming languages and to extend existing ones with domain-specific sub-languages. This paper describes McMicMac, a framework for generative programming. McMicMac uses tree-transforming macros as language specifications, and enhances them with inherited and synthesized attributes. The enhanced transformers can describe general compilation tasks. Families of these specifications are grouped into mixin-like collections called vocabularies. Programmers can define new languages by composing these vocabularies. We have implemented McMicMac for Scheme and used it to build several systems, including the DrScheme programming environment. The principles of McMicMac carry over to other languages and environments.

This work is partially supported by NSF grants CCR-9619756, CDA-9713032, and CCR-9708957, and a Texas ATP grant

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. Batory, D., B. Lofaso and Y. Smaragdakis. JTS: Tools for implementing domain-specific languages. In International Conference on Software Reuse, June 1998.

    Google Scholar 

  2. Batory, D. and S. O’Malley. The design and implementation of hierarchical software systems with reusable components. ACM Transactions on Software Engineering and Methodology, 1(4):355–398, October 1992.

    Article  Google Scholar 

  3. Bracha, G. The Programming Language Jigsaw: Mixins, Modularity and Multiple Inheritance. PhD thesis, University of Utah, March 1992.

    Google Scholar 

  4. Cardelli, L., F. Matthes and M. Abadi. Extensible syntax with lexical scoping. Research Report 121, Digital SRC, 1994.

    Google Scholar 

  5. Christensen, C. and C. J. Shaw, editors. Proceedings of the Extensible Languages Symposium. Association for Computing Machinery, 1969. Appeared as SIGPLAN Notices, 4(8):1–62, August 1969.

    Google Scholar 

  6. Christiansen, H. A survey of adaptable grammars. ACM SIGPLAN Notices, 25(11):35–44, November 1990.

    Article  Google Scholar 

  7. Clinger, W. D. Proper tail recursion and space efficiency. In ACM SIGPLAN Conference on Programming Language Design and Implementation, pages 174–185, June 1998.

    Google Scholar 

  8. Czarnecki, K. and U. Eisenecker. Generative Programming: Methods, Techniques, and Applications. Addison-Wesley, 1999.

    Google Scholar 

  9. Dybvig, R. K., D. P. Friedman and C. T. Haynes. Expansion-passing style: A general macro mechanism. Lisp and Symbolic Computation, 1(1):53–75, January 1988.

    Article  Google Scholar 

  10. Dybvig, R. K., R. Hieb and C. Bruggeman. Syntactic abstraction in Scheme. Lisp and Symbolic Computation, 5(4):295–326, December 1993.

    Article  Google Scholar 

  11. Fairbairn, J. Making form follow function: An exercise in functional programming style. Software—Practice and Experience, 17(6):379–386, June 1987.

    Article  Google Scholar 

  12. Findler, R. B., C. Flanagan, M. Flatt, S. Krishnamurthi and M. Felleisen. DrScheme: A pedagogic programming environment for Scheme. In Ninth International Symposium on Programming Languages, Implementations, Logics, and Programs, pages 369–388, 1997.

    Google Scholar 

  13. Flanagan, C., M. Flatt, S. Krishnamurthi, S. Weirich and M. Felleisen. Catching bugs in the web of program invariants. In ACM SIGPLAN Conference on Programming Language Design and Implementation, pages 23–32, May 1996

    Google Scholar 

  14. Flatt, M. PLT MzScheme: Language manual. Technical Report TR97-280, Rice University, 1997.

    Google Scholar 

  15. Flatt, M., S. Krishnamurthi and M. Felleisen. Classes and mixins. In Symposium on Principles of Programming Languages, pages 171–183, January 1998.

    Google Scholar 

  16. Gamma, E., R. Helm, R. Johnson and J. Vlissides. Design Patterns: Elements of Reusable Object-Oriented Software. Addison-Wesley Personal Computing Series. Addison-Wesley, Reading, MA, 1995.

    Google Scholar 

  17. Hudak, P. Modular domain specific languages and tools. In International Conference on Software Reuse, 1998.

    Google Scholar 

  18. Hudak, P., S. Peyton Jones and P. Wadler. Report on the programming language Haskell: a non-strict, purely functional language. ACM SIGPLAN Notices, 27(5), May 1992. Version 1.2.

    Google Scholar 

  19. Johnson, S. C. YACC — yet another compiler compiler. Computing Science Technical Report 32, AT&T Bell Laboratories, Murray Hill, NJ, USA, 1975.

    Google Scholar 

  20. Kamin, S. and D. Hyatt. A special-purpose language for picture-drawing. In USENIX Conference on Domain-Specific Languages, 1997.

    Google Scholar 

  21. Kelsey, R., W. Clinger and J. Rees. Revised5 report on the algorithmic language Scheme. ACM SIGPLAN Notices, 33(9), October 1998.

    Google Scholar 

  22. Kernighan, B. W. and D. M. Ritchie. The C Programming Language. Prentice-Hall, 1988.

    Google Scholar 

  23. Kohlbecker, E. E., D. P. Friedman, M. Felleisen and B. F. Duba. Hygienic macro expansion. In ACM Symposium on Lisp and Functional Programming, pages 151–161, 1986.

    Google Scholar 

  24. Kohlbecker, E. E. and M. Wand. Macros-by-example: Deriving syntactic trans-formations from their specifications. In Symposium on Principles of Programming Languages, pages 77–84, 1987.

    Google Scholar 

  25. Kohlbecker Jr, E. E. Syntactic Extensions in the Programming Language Lisp. PhD thesis, Indiana University, August 1986.

    Google Scholar 

  26. Krishnamurthi, S., Y.-D. Erlich and M. Felleisen. Expressing structural properties as language constructs. In European Symposium on Programming, March 1999.

    Google Scholar 

  27. Krishnamurthi, S., M. Felleisen and D. P. Friedman. Synthesizing object-oriented and functional design to promote re-use. In European Conference on Object-Oriented Programming, pages 91–113, July 1998.

    Google Scholar 

  28. Lieberherr, K. J. Adaptive Object-Oriented Programming. PWS Publishing, Boston, MA, USA, 1996.

    Google Scholar 

  29. McIlroy, M. D. Macro instruction extensions of compiler languages. Communications of the ACM, 3(4):214–220, 1960.

    Article  MATH  Google Scholar 

  30. Milner, R., M. Tofte and R. Harper. The Definition of Standard ML. MIT Press, Cambridge, MA, 1990.

    Google Scholar 

  31. Moggi, E. An abstract view of programming languages. Technical Report ECS-LFCS-90-113, Laboratory for Foundations of Computer Science, University of Edinburgh, Edinburgh, Scotland, 1990.

    Google Scholar 

  32. Smaragdakis, Y. and D. Batory. Implementing layered designs and mixin layers. In European Conference on Object-Oriented Programming, pages 550–570, July 1998.

    Google Scholar 

  33. Steele, G. L., Jr., editor. Common Lisp: the Language. Digital Press, Bedford, MA, second edition, 1990.

    MATH  Google Scholar 

  34. Taha, W. and T. Sheard. Multi-stage programming with explicit annotations. In ACM SIGPLAN Symposium on Partial Evaluation and Semantics-Based Program Manipulation, pages 203–217, 1997.

    Google Scholar 

  35. Wadler, P. The essence of functional programming. In Symposium on Principles of Programming Languages, pages 1–14, January 1992.

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2000 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Krishnamurthi, S., Felleisen, M., Duba, B.F. (2000). From Macros to Reusable Generative Programming. In: Czarnecki, K., Eisenecker, U.W. (eds) Generative and Component-Based Software Engineering. GCSE 1999. Lecture Notes in Computer Science, vol 1799. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-40048-6_9

Download citation

  • DOI: https://doi.org/10.1007/3-540-40048-6_9

  • Published:

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-41172-7

  • Online ISBN: 978-3-540-40048-6

  • eBook Packages: Springer Book Archive

Publish with us

Policies and ethics