Macros that compose: Systematic macro programming

Research output: Chapter in Book/Report/Conference proceedingConference contribution

3 Citations (Scopus)

Abstract

Macros are often regarded as a sort of black magic: highly useful yet abstruse. The present paper aims to make macro programming more like a craft. Using R5RS Scheme macros as an example, we develop and present a general practical methodology of building complex macros systematically, by combining simpler components by functional composition or higher-order operators. Macro programming is complex because the systematic approach does not apply to many macros. We show that macros and other head-first normal-order re-writing systems generally lack functional composition. However, macros written in a continuation-passing style (CPS) always compose. Making CPS macros practical still requires an encoding for macro-continuations. We have found this missing piece, with an insight for anonymous macro-level abstractions. In the specific case of R5RS macros, this paper presents a stronger result: developing R5RS macros by a translation from the corresponding Scheme procedures. We demonstrate the practical use of the technique by elaborating a real-world example.

Original languageEnglish
Title of host publicationGenerative Programming and Component Engineering - ACM SIGPLAN/SIGSOFT Conference, GPCE 2002, Proceedings
EditorsDon Batory, Charles Consel, Walid Taha
PublisherSpringer Verlag
Pages202-217
Number of pages16
ISBN (Electronic)3540442847, 9783540442844
DOIs
Publication statusPublished - 2002
Event1st ACM SIGPLAN/SIGSOFT International Conference on Generative Programming and Component Engineering, GPCE 2002 - Pittsburgh, United States
Duration: 2002 Oct 62002 Oct 8

Publication series

NameLecture Notes in Computer Science (including subseries Lecture Notes in Artificial Intelligence and Lecture Notes in Bioinformatics)
Volume2487
ISSN (Print)0302-9743
ISSN (Electronic)1611-3349

Other

Other1st ACM SIGPLAN/SIGSOFT International Conference on Generative Programming and Component Engineering, GPCE 2002
CountryUnited States
CityPittsburgh
Period02/10/602/10/8

ASJC Scopus subject areas

  • Theoretical Computer Science
  • Computer Science(all)

Fingerprint Dive into the research topics of 'Macros that compose: Systematic macro programming'. Together they form a unique fingerprint.

  • Cite this

    Kiselyov, O. (2002). Macros that compose: Systematic macro programming. In D. Batory, C. Consel, & W. Taha (Eds.), Generative Programming and Component Engineering - ACM SIGPLAN/SIGSOFT Conference, GPCE 2002, Proceedings (pp. 202-217). (Lecture Notes in Computer Science (including subseries Lecture Notes in Artificial Intelligence and Lecture Notes in Bioinformatics); Vol. 2487). Springer Verlag. https://doi.org/10.1007/3-540-45821-2_13