Macros that compose: Systematic macro programming

Research output: Chapter in Book/Report/Conference proceedingConference contributionpeer-review

4 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

Conference

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

Fingerprint

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

Cite this