Hostname: page-component-78c5997874-m6dg7 Total loading time: 0 Render date: 2024-11-06T07:55:18.406Z Has data issue: false hasContentIssue false

Fortifying macros

Published online by Cambridge University Press:  15 August 2012

RYAN CULPEPPER*
Affiliation:
School of Computing, Salt Lake City, Utah, USA (e-mail: [email protected])
Rights & Permissions [Opens in a new window]

Abstract

Core share and HTML view are not available for this content. However, as you have access to this content, a full PDF is available via the ‘Save PDF’ action button.

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.

Type
Articles
Copyright
Copyright © Cambridge University Press 2012

References

Culpepper, R. & Felleisen, M. (2004) Taming macros. In International Conference on Generative Programming and Component Engineering, pp. 225–243.CrossRefGoogle Scholar
Despeyroux, T. (October 1995) Logical programming and error recovery. Industrial Applications of Prolog.Google Scholar
Dybvig, R. K. (2010) Chez scheme version 8 users's guide. Cadence Research Systems.Google Scholar
Dybvig, R. K., Hieb, R. & Bruggeman, C. (1993) Syntactic abstraction in Scheme. Lisp Symb. Comput. 5 (4), 295326.Google Scholar
Findler, R. B., Clements, J., Flanagan, C., Flatt, M., Krishnamurthi, S., Steckler, P. & Felleisen, M. (2002) DrScheme: A programming environment for Scheme. J. Funct. Program. 12 (2), 159182.CrossRefGoogle Scholar
Flatt, M. (2002) Composable and compilable macros: You want it when? In International Conference on Functional Programming, pp. 72–83.Google Scholar
Flatt, M., Barzilay, E. & Findler, R. B. (2009) Scribble: Closing the book on ad hoc documentation tools. In International Conference on Functional Programming, pp. 109–120.CrossRefGoogle Scholar
Flatt, M., Findler, R. B. & Felleisen, M. (November 2006) Scheme with classes, mixins, and traits. In Asian Symposium on Programming Languages and Systems, pp. 270–289.CrossRefGoogle Scholar
Flatt, M. & PLT. (January 2010) Reference: Racket. Tech. Rep. PLT [online]. Accessed July 2012. Available at: http://racket-lang.org/tr1/.Google Scholar
Ford, B. (September 2002) Packrat Parsing: A Practical Linear-time Algorithm with Backtracking. MPhil thesis, Massachusetts Institute of Technology.CrossRefGoogle Scholar
Herman, D. & Wand, M. (March 2008) A theory of hygienic macros. In European Symposium on Programming, pp. 48–62.CrossRefGoogle Scholar
Hilsdale, E. & Friedman, D. P. (2000) Writing macros in continuation-passing style. In Workshop on Scheme and Functional Programming, pp. 53–59.Google Scholar
Hughes, J. (1995) The design of a pretty-printing library. In Advanced Functional Programming, First International Spring School on Advanced Functional Programming Techniques: Tutorial Text. London, UK: Springer-Verlag, pp. 5396.Google Scholar
Kohlbecker, E. E. & Wand, M. (1987) Macro-by-example: Deriving syntactic transformations from their specifications. In Symposium on Principles of Programming Languages, pp. 77–84.CrossRefGoogle Scholar
Landin, P. J. (1965) Correspondence between ALGOL 60 and Church's lambda-notation: Part I. Commun. ACM 8 (2), 89101.CrossRefGoogle Scholar
Le Fessant, F. & Maranget, L. (2001) Optimizing pattern matching. In International Conference on Functional Programming, pp. 26–37.CrossRefGoogle Scholar
Owens, S., Flatt, M., Shivers, O. & McMullan, B. (September 2004) Lexer and parser generators in Scheme. In Workshop on Scheme and Functional Programming, pp. 41–52.Google Scholar
Queinnec, C. (1996) Macroexpansion reflective tower. In Proceedings of the Reflection'96 Conference, pp. 93–104.Google Scholar
Shivers, O. (2005) The anatomy of a loop: A story of scope and control. In International Conference on Functional Programming, pp. 2–14.CrossRefGoogle Scholar
Sperber, M., Dybvig, R. K., Flatt, M., van Straaten, A., Findler, R. & Matthews, J. (2009) Revised6 report of the algorithmic language Scheme. J. Funct. Program. 19 (S1), 1301.CrossRefGoogle Scholar
van den Brand, M. G. J., Scheerder, J., Vinju, J. J. & Visser, E. (2002) Disambiguation filters for scannerless generalized LR parsers. In Compiler Construction. Horspool, N. (ed). Springer-Verlag, pp. 143158.CrossRefGoogle Scholar
Wand, M. & Vaillancourt, D. (2004) Relating models of backtracking. In International Conference on Functional Programming, pp. 54–65.CrossRefGoogle Scholar
Submit a response

Discussions

No Discussions have been published for this article.