Marco: Safe, Expressive Macros for Any Language

被引:0
|
作者
Lee, Byeongcheol [1 ]
Grimm, Robert [2 ]
Hirzel, Martin [3 ]
McKinley, Kathryn S. [4 ,5 ]
机构
[1] Gwangju Inst Sci & Technol, Gwangju, South Korea
[2] NYU, New York, NY 10003 USA
[3] IBM Watson Res Ctr, Bangalore, Karnataka, India
[4] Microsoft Res, Bangalore, Karnataka, India
[5] Univ Texas Austin, Austin, TX 78712 USA
来源
基金
美国国家科学基金会;
关键词
D O I
暂无
中图分类号
TP3 [计算技术、计算机技术];
学科分类号
0812 ;
摘要
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.
引用
收藏
页码:589 / 613
页数:25
相关论文
共 50 条
  • [1] ASSEMBLY LANGUAGE MACROS
    SKIER, K
    [J]. DR DOBBS JOURNAL, 1991, 16 (03): : 28 - &
  • [2] Cedar: A New Language for Expressive, Fast, Safe, and Analyzable Authorization
    Cutler, Joseph W.
    Disselkoen, Craig
    Eline, Aaron
    He, Shaobo
    Headley, Kyle
    Hicks, Michael
    Hietala, Kesha
    Ioannidis, Eleftherios
    Kastner, John
    Mamat, Anwar
    Mcadams, Darin
    McCutchen, Matt
    Rungta, Neha
    Torlak, Emina
    Wells, Andrew M.
    [J]. PROCEEDINGS OF THE ACM ON PROGRAMMING LANGUAGES-PACMPL, 2024, 8 (OOPSLA):
  • [3] LANGUAGE PROTOTYPING WITH ATTRIBUTE GRAMMARS AND MACROS
    SVEDA, M
    [J]. MICROPROCESSING AND MICROPROGRAMMING, 1993, 39 (2-5): : 151 - 154
  • [4] On expressive language
    Brown, Roger W.
    [J]. LANGUAGE, 1955, 31 (04) : 543 - 549
  • [5] Macros as multi-stage computations: Type-safe, generative, binding macros in MacroML
    Ganz, SE
    Sabry, A
    Taha, W
    [J]. ACM SIGPLAN NOTICES, 2001, 36 (10) : 74 - 85
  • [6] MACROS FOR TEACHING THIRD GENERATION ASSEMBLY LANGUAGE
    FLORES, I
    LEVIN, P
    [J]. JOURNAL OF EDUCATIONAL DATA PROCESSING, 1972, 9 (04): : 9 - &
  • [7] An expressive language of signatures
    Ramsey, N
    Fisher, K
    Govereau, P
    [J]. ACM SIGPLAN NOTICES, 2005, 40 (09) : 27 - 40
  • [8] MACROS - A NEGLECTED TECHNIQUE IN ASSEMBLY LANGUAGE PROGRAMMING
    GOODALL, RM
    [J]. MICROPROCESSORS AND MICROSYSTEMS, 1989, 13 (07) : 437 - 444
  • [9] LANGUAGE AS EXPRESSIVE BEHAVIOR
    LORENZ, M
    [J]. AMA ARCHIVES OF NEUROLOGY AND PSYCHIATRY, 1953, 70 (03): : 277 - 285
  • [10] RECEPTIVE AND EXPRESSIVE LANGUAGE
    SAPON, SM
    [J]. AMERICAN PSYCHOLOGIST, 1965, 20 (07) : 476 - 476