skip to main content
research-article

Fortifying macros

Published:27 September 2010Publication History
Skip Abstract Section

Abstract

Existing macro systems force programmers to make a choice between clarity of specification and robustness. If they choose clarity, they must forgo validating significant parts of the specification and thus produce low-quality language extensions. If they choose robustness, they must write in a style that mingles the implementation with the specification and therefore obscures the latter.

This paper introduces a new language for writing macros. With the new macro system, programmers naturally write robust language extensions using easy-to-understand specifications. The system translates these specifications into validators that detect misuses - including violations of context-sensitive constraints - and automatically synthesize appropriate feedback, eliminating the need for ad hoc validation code.

Skip Supplemental Material Section

Supplemental Material

icfp-tues-1630-culpepper.mov

References

  1. }}Cadence Research Systems. Chez Scheme Reference Manual, 1994.Google ScholarGoogle Scholar
  2. }}R. Culpepper and M. Felleisen. Taming macros. In International Conference on Generative Programming and Component Engineering, pages 225--243, 2004.Google ScholarGoogle ScholarCross RefCross Ref
  3. }}T. Despeyroux. Logical programming and error recovery. In Industrial Applications of Prolog, Oct. 1995.Google ScholarGoogle Scholar
  4. }}R. K. Dybvig, R. Hieb, and C. Bruggeman. Syntactic abstraction in Scheme. Lisp and Symbolic Computation, 5 (4): 295--326, Dec. 1993. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. }}F. L. Fessant and L. Maranget. Optimizing pattern matching. In International Conference on Functional Programming, pages 26--37, 2001. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. }}R. B. Findler, J. Clements, C. Flanagan, M. Flatt, S. Krishnamurthi, P. Steckler, and M. Felleisen. DrScheme: A programming environment for Scheme. Journal of Functional Programming, 12 (2): 159--182, 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. }}M. Flatt and PLT. Reference: Racket. Technical report, PLT Inc., January 2010. http://racket-lang.org/tr1/.Google ScholarGoogle Scholar
  8. }}B. Ford. Packrat parsing: a practical linear-time algorithm with backtracking. Master's thesis, Massachusetts Institute of Technology, Sept. 2002.Google ScholarGoogle Scholar
  9. }}D. Herman and M. Wand. A theory of hygienic macros. In European Symposium on Programming, pages 48--62, Mar. 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. }}E. Hilsdale and D. P. Friedman. Writing macros in continuation-passing style. In Workshop on Scheme and Functional Programming, pages 53--59, 2000.Google ScholarGoogle Scholar
  11. }}J. Hughes. The design of a pretty-printing library. In Advanced Functional Programming, First International Spring School on Advanced Functional Programming Techniques-Tutorial Text, pages 53--96, London, UK, 1995. Springer-Verlag. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. }}E. E. Kohlbecker and M. Wand. Macro-by-example: Deriving syntactic transformations from their specifications. In Symposium on Principles of Programming Languages, pages 77--84, 1987. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. }}P. J. Landin. Correspondence between ALGOL 60 and Church's lambda-notation: part i. Commun. ACM, 8 (2): 89--101, 1965. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. }}S. Owens, M. Flatt, O. Shivers, and B. McMullan. Lexer and parser generators in Scheme. In Workshop on Scheme and Functional Programming, pages 41--52, Sept. 2004.Google ScholarGoogle Scholar
  15. }}O. Shivers. The anatomy of a loop: a story of scope and control. In International Conference on Functional Programming, pages 2--14, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. }}M. Sperber, R. K. Dybvig, M. Flatt, A. van Straaten, R. Findler, and J. Matthews. Revised6 report of the algorithmic language Scheme. Journal of Functional Programming, 19 (S1): 1--301, Aug. 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. }}M. Wand and D. Vaillancourt. Relating models of backtracking. In International Conference on Functional Programming, pages 54--65, 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Fortifying macros

    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

    Full Access

    • Published in

      cover image ACM SIGPLAN Notices
      ACM SIGPLAN Notices  Volume 45, Issue 9
      ICFP '10
      September 2010
      382 pages
      ISSN:0362-1340
      EISSN:1558-1160
      DOI:10.1145/1932681
      Issue’s Table of Contents
      • cover image ACM Conferences
        ICFP '10: Proceedings of the 15th ACM SIGPLAN international conference on Functional programming
        September 2010
        398 pages
        ISBN:9781605587943
        DOI:10.1145/1863543

      Copyright © 2010 ACM

      Publisher

      Association for Computing Machinery

      New York, NY, United States

      Publication History

      • Published: 27 September 2010

      Check for updates

      Qualifiers

      • research-article

    PDF Format

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader

    ePub

    View this article in ePub.

    View ePub
    About Cookies On This Site

    We use cookies to ensure that we give you the best experience on our website.

    Learn more

    Got it!