Marco: Safe, expressive macros for any language

Byeongcheol Lee, Robert Grimm, Martin Hirzel, Kathryn S. McKinley

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

Abstract

Macros improve expressiveness, concision, abstraction, and language interoperability without changing the programming language itself. They are indispensable for building increasingly prevalent multilingual applications. Unfortunately, existing macro systems are well-encapsulated but unsafe (e.g., the C preprocessor) or are safe but tightly-integrated with the language implementation (e.g., Scheme macros). This paper introduces Marco, the first macro system that seeks both encapsulation and safety. Marco is based on the observation that the macro system need not know all the syntactic and semantic rules of the target language but must only directly enforce some rules, such as variable name binding. Using this observation, Marco off-loads most rule checking to unmodified target-language compilers and interpreters and thus becomes language-scalable. We describe the Marco language, its language-independent safety analysis, and how it uses two example target-language analysis plug-ins, one for C++ and one for SQL. This approach opens the door to safe and expressive macros for any language.

Original languageEnglish (US)
Title of host publicationECOOP 2012 - Object-Oriented Programming
Subtitle of host publication26th European Conference, Proceedings
PublisherSpringer Verlag
Pages589-613
Number of pages25
ISBN (Print)9783642310560
DOIs
StatePublished - 2012
Event26th European Conference on Object-Oriented Programming, ECOOP 2012 - Beijing, China
Duration: Jun 11 2012Jun 16 2012

Publication series

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

Other

Other26th European Conference on Object-Oriented Programming, ECOOP 2012
Country/TerritoryChina
CityBeijing
Period6/11/126/16/12

ASJC Scopus subject areas

  • Theoretical Computer Science
  • General Computer Science

Fingerprint

Dive into the research topics of 'Marco: Safe, expressive macros for any language'. Together they form a unique fingerprint.

Cite this