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
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
References
Batory, D., B. Lofaso and Y. Smaragdakis. JTS: Tools for implementing domain-specific languages. In International Conference on Software Reuse, June 1998.
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.
Bracha, G. The Programming Language Jigsaw: Mixins, Modularity and Multiple Inheritance. PhD thesis, University of Utah, March 1992.
Cardelli, L., F. Matthes and M. Abadi. Extensible syntax with lexical scoping. Research Report 121, Digital SRC, 1994.
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.
Christiansen, H. A survey of adaptable grammars. ACM SIGPLAN Notices, 25(11):35–44, November 1990.
Clinger, W. D. Proper tail recursion and space efficiency. In ACM SIGPLAN Conference on Programming Language Design and Implementation, pages 174–185, June 1998.
Czarnecki, K. and U. Eisenecker. Generative Programming: Methods, Techniques, and Applications. Addison-Wesley, 1999.
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.
Dybvig, R. K., R. Hieb and C. Bruggeman. Syntactic abstraction in Scheme. Lisp and Symbolic Computation, 5(4):295–326, December 1993.
Fairbairn, J. Making form follow function: An exercise in functional programming style. Software—Practice and Experience, 17(6):379–386, June 1987.
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.
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
Flatt, M. PLT MzScheme: Language manual. Technical Report TR97-280, Rice University, 1997.
Flatt, M., S. Krishnamurthi and M. Felleisen. Classes and mixins. In Symposium on Principles of Programming Languages, pages 171–183, January 1998.
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.
Hudak, P. Modular domain specific languages and tools. In International Conference on Software Reuse, 1998.
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.
Johnson, S. C. YACC — yet another compiler compiler. Computing Science Technical Report 32, AT&T Bell Laboratories, Murray Hill, NJ, USA, 1975.
Kamin, S. and D. Hyatt. A special-purpose language for picture-drawing. In USENIX Conference on Domain-Specific Languages, 1997.
Kelsey, R., W. Clinger and J. Rees. Revised5 report on the algorithmic language Scheme. ACM SIGPLAN Notices, 33(9), October 1998.
Kernighan, B. W. and D. M. Ritchie. The C Programming Language. Prentice-Hall, 1988.
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.
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.
Kohlbecker Jr, E. E. Syntactic Extensions in the Programming Language Lisp. PhD thesis, Indiana University, August 1986.
Krishnamurthi, S., Y.-D. Erlich and M. Felleisen. Expressing structural properties as language constructs. In European Symposium on Programming, March 1999.
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.
Lieberherr, K. J. Adaptive Object-Oriented Programming. PWS Publishing, Boston, MA, USA, 1996.
McIlroy, M. D. Macro instruction extensions of compiler languages. Communications of the ACM, 3(4):214–220, 1960.
Milner, R., M. Tofte and R. Harper. The Definition of Standard ML. MIT Press, Cambridge, MA, 1990.
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.
Smaragdakis, Y. and D. Batory. Implementing layered designs and mixin layers. In European Conference on Object-Oriented Programming, pages 550–570, July 1998.
Steele, G. L., Jr., editor. Common Lisp: the Language. Digital Press, Bedford, MA, second edition, 1990.
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.
Wadler, P. The essence of functional programming. In Symposium on Principles of Programming Languages, pages 1–14, January 1992.
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights 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