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: 26th European Conference, Proceedings
Pages589-613
Number of pages25
Volume7313 LNCS
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)03029743
ISSN (Electronic)16113349

Other

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

Fingerprint

Macros
Target
Syntactics
Encapsulation
Interoperability
Computer programming languages
Language
Safety Analysis
Semantics
Expressiveness
C++
Compiler
Programming Languages
Safety

ASJC Scopus subject areas

  • Computer Science(all)
  • Theoretical Computer Science

Cite this

Lee, B., Grimm, R., Hirzel, M., & McKinley, K. S. (2012). Marco: Safe, expressive macros for any language. In ECOOP 2012 - Object-Oriented Programming: 26th European Conference, Proceedings (Vol. 7313 LNCS, pp. 589-613). (Lecture Notes in Computer Science (including subseries Lecture Notes in Artificial Intelligence and Lecture Notes in Bioinformatics); Vol. 7313 LNCS). https://doi.org/10.1007/978-3-642-31057-7-26

Marco : Safe, expressive macros for any language. / Lee, Byeongcheol; Grimm, Robert; Hirzel, Martin; McKinley, Kathryn S.

ECOOP 2012 - Object-Oriented Programming: 26th European Conference, Proceedings. Vol. 7313 LNCS 2012. p. 589-613 (Lecture Notes in Computer Science (including subseries Lecture Notes in Artificial Intelligence and Lecture Notes in Bioinformatics); Vol. 7313 LNCS).

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

Lee, B, Grimm, R, Hirzel, M & McKinley, KS 2012, Marco: Safe, expressive macros for any language. in ECOOP 2012 - Object-Oriented Programming: 26th European Conference, Proceedings. vol. 7313 LNCS, Lecture Notes in Computer Science (including subseries Lecture Notes in Artificial Intelligence and Lecture Notes in Bioinformatics), vol. 7313 LNCS, pp. 589-613, 26th European Conference on Object-Oriented Programming, ECOOP 2012, Beijing, China, 6/11/12. https://doi.org/10.1007/978-3-642-31057-7-26
Lee B, Grimm R, Hirzel M, McKinley KS. Marco: Safe, expressive macros for any language. In ECOOP 2012 - Object-Oriented Programming: 26th European Conference, Proceedings. Vol. 7313 LNCS. 2012. p. 589-613. (Lecture Notes in Computer Science (including subseries Lecture Notes in Artificial Intelligence and Lecture Notes in Bioinformatics)). https://doi.org/10.1007/978-3-642-31057-7-26
Lee, Byeongcheol ; Grimm, Robert ; Hirzel, Martin ; McKinley, Kathryn S. / Marco : Safe, expressive macros for any language. ECOOP 2012 - Object-Oriented Programming: 26th European Conference, Proceedings. Vol. 7313 LNCS 2012. pp. 589-613 (Lecture Notes in Computer Science (including subseries Lecture Notes in Artificial Intelligence and Lecture Notes in Bioinformatics)).
@inproceedings{d23b82ab9c4c4cb9b78ee3f6a35aab79,
title = "Marco: Safe, expressive macros for any language",
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.",
author = "Byeongcheol Lee and Robert Grimm and Martin Hirzel and McKinley, {Kathryn S.}",
year = "2012",
doi = "10.1007/978-3-642-31057-7-26",
language = "English (US)",
isbn = "9783642310560",
volume = "7313 LNCS",
series = "Lecture Notes in Computer Science (including subseries Lecture Notes in Artificial Intelligence and Lecture Notes in Bioinformatics)",
pages = "589--613",
booktitle = "ECOOP 2012 - Object-Oriented Programming: 26th European Conference, Proceedings",

}

TY - GEN

T1 - Marco

T2 - Safe, expressive macros for any language

AU - Lee, Byeongcheol

AU - Grimm, Robert

AU - Hirzel, Martin

AU - McKinley, Kathryn S.

PY - 2012

Y1 - 2012

N2 - 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.

AB - 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.

UR - http://www.scopus.com/inward/record.url?scp=84879728830&partnerID=8YFLogxK

UR - http://www.scopus.com/inward/citedby.url?scp=84879728830&partnerID=8YFLogxK

U2 - 10.1007/978-3-642-31057-7-26

DO - 10.1007/978-3-642-31057-7-26

M3 - Conference contribution

SN - 9783642310560

VL - 7313 LNCS

T3 - Lecture Notes in Computer Science (including subseries Lecture Notes in Artificial Intelligence and Lecture Notes in Bioinformatics)

SP - 589

EP - 613

BT - ECOOP 2012 - Object-Oriented Programming: 26th European Conference, Proceedings

ER -