ABSTRACT
Many macro systems, especially for Lisp and Scheme, allow macro transformers to perform general computation. Moreover, the language for implementing compile-time macro transformers is usually the same as the language for implementing run-time functions. As a side effect of this sharing, implementations tend to allow the mingling of compile-time values and run-time values, as well as values from separate compilations. Such mingling breaks programming tools that must parse code without executing it. Macro implementors avoid harmful mingling by obeying certain macro-definition protocols and by inserting phase-distinguishing annotations into the code. However, the annotations are fragile, the protocols are not enforced, and programmers can only reason about the result in terms of the compiler's implementation. MzScheme---the language of the PLT Scheme tool suite---addresses the problem through a macro system that separates compilation without sacrificing the expressiveness of macros.
- J. Baker and W. C. Hsieh. Maya: Multiple-dispatch syntax extension in Java. In Proc. ACM Conference on Programming Language Design and Implementation, pages 270--281, June 2002.]] Google ScholarDigital Library
- A. Bawden and J. Rees. Syntactic closures. In Proc. ACM Conference on Lisp and Functional Programming, pages 86--95, July 1988.]] Google ScholarDigital Library
- H. Bromley. Lisp Lore: A Guide to Programming the Lisp Machine. Kluwer Academic Publishers, 1986.]] Google ScholarDigital Library
- W. Clinger and J. Rees. Macros that work. In Proc. ACM Symposium on Principles of Programming Languages, pages 155--162, Jan. 1991.]] Google ScholarDigital Library
- P. Curtis and J. Rauen. A module system for Scheme. In Proc. ACM Conference on Lisp and Functional Programming, pages 13--28, 1990.]] Google ScholarDigital Library
- R. Davies and F. Pfenning. A modal analysis of staged computation. In Proc. ACM Symposium on Principles of Programming Languages, pages 258--270, Jan. 1996.]] Google ScholarDigital Library
- R. K. Dybvig. Chez Scheme User's Guide. Cadence Research Systems, 1998.]]Google Scholar
- R. K. Dybvig, R. Hieb, and C. Bruggeman. Syntactic abstraction in Scheme. Lisp and Symbolic Computation, 5(4):295--326, 1993.]] Google ScholarDigital Library
- M. Flatt and M. Felleisen. Units: Cool modules for HOT languages. In Proc. ACM Conference on Programming Language Design and Implementation, pages 236--248, June 1998.]] Google ScholarDigital Library
- D. P. Friedman, M. Wand, and C. P. Haynes. Essentials of Programming Languages. The MIT Press, Cambridge, Massachusetts, 2001.]] Google ScholarDigital Library
- S. Ganz, A. Sabry, and W. Taha. Macros as multi-stage computations: Type-safe, generative, binding macros in MacroML. In Proc. ACM International Conference on Functional Programming, pages 74--85, Sept. 2001.]] Google ScholarDigital Library
- T. P. Hart and T. G. Evans. Notes on implementing lisp for the m-460 computer. In E. C. Berkeley and D. G. Bowbrow, editors, The Programming language LISP: Its Operation and Applications, pages 191--203. MIT Press, 1964.]]Google Scholar
- R. Kelsey. SRFI 19: Defining record types, 1999. http://srfi.schemers.org/srfi-9/.]]Google Scholar
- R. Kelsey, W. Clinger, and J. Rees (Eds.). The revised5 report on the algorithmic language Scheme. ACM SIGPLAN Notices, 33(9), Sept. 1998.]] Google ScholarDigital Library
- E. Kohlbecker, D. P. Friedman, M. Felleisen, and B. Duba. Hygienic macro expansion. In Proc. ACM Conference on Lisp and Functional Programming, pages 151--181, Aug. 1986.]] Google ScholarDigital Library
- E. Moggi, W. Taha, Z. El-Abidine Benaissa, and T. Sheard. An idealized MetaML: Simpler, and more expressive. In Proc. European Symposium on Programming, volume 1576 of Lecture Notes in Computer Science, pages 193--207. Springer-Verlag, Apr. 1999.]] Google ScholarDigital Library
- D. A. Moon. MACLISP Reference Manual. MIT Press, 1974.]]Google Scholar
- M. Poletto, W. C. Hsieh, D. R. Engler, and M. F. Kaashoek. 'C and tcc: a language and compiler for dynamic code generation. ACM Transactions on Computing Systems, 21(2):324--369, Mar. 1999.]] Google ScholarDigital Library
- C. Queinnec. Macroexpansion reflective tower. In Proc. Reflections Conference, pages 93--194, Apr. 1996.]]Google Scholar
- J. Rees. Another module system for Scheme, 1994. Scheme48 documentation.]]Google Scholar
- M. Serrano. Bigloo: A "practical Scheme compiler", 2002.]]Google Scholar
- A. Shalit. The Dylan Reference Manual. Addison-Wesley, 1996.]]Google Scholar
- G. L. Steele Jr. Common Lisp: The Language. Digital Press, second edition, 1990.]] Google ScholarDigital Library
- G. L. Steele, Jr. and G. J. Sussman. The revised report on SCHEME: A dialect of LISP. Technical Report 452, MIT, Jan. 1978.]]Google Scholar
- O. Waddell and R. K. Dybvig. Extending the scope of syntactic abstraction. In Proc. ACM Symposium on Principles of Programming Languages, pages 203--213, Jan. 1999.]] Google ScholarDigital Library
- D. Weise and R. F. Crew. Programmable syntax macros. In Proc. ACM Conference on Programming Language Design and Implementation, pages 156--165, June 1993.]] Google ScholarDigital Library
- A. K. Wright. Pattern Matching for Scheme, Mar. 1996.]]Google Scholar
Index Terms
- Composable and compilable macros:: you want it when?
Recommendations
Macros for domain-specific languages
Macros provide a powerful means of extending languages. They have proven useful in both general-purpose and domain-specific programming contexts. This paper presents an architecture for implementing macro-extensible DSLs on top of macro-extensible host ...
Composable and compilable macros:: you want it when?
Many macro systems, especially for Lisp and Scheme, allow macro transformers to perform general computation. Moreover, the language for implementing compile-time macro transformers is usually the same as the language for implementing run-time functions. ...
Submodules in racket: you want it when, again?
GPCE '13: Proceedings of the 12th international conference on Generative programming: concepts & experiencesIn an extensible programming language, programmers write code that must run at different times - in particular, at compile time versus run time. The module system of the Racket programming language enables a programmer to reason about programs in the ...
Comments