Macro

The term for a way to extend the syntax and semantics of a programming language; they are a special case of compile-time rewrite.

Macros operate at the level of a structure in which the language is modeled, which can be at various levels: theoretical monads, abstract syntax trees, lexer tokens, or character strings. The higher-level methods of doing this generally offer cleaner methods of expressing these transformations, and are preferred when accessible.

They are a particular case of metaprogramming, done within a language itself, as a restricted form of compile-time reflection?. The integration of macros with general compile-time reflection requires the availability of suitable ways to control code emission, that are not usually available in standard macro systems; in general these subjects are considered separate, except when open implementations are explicitly brought up.


This page is linked from: C Compiler dlopen VM   Continuation-Passing Style   FDScript   Felix   FreshML   Lisp   PL 101   Scheme   Syntax in Lisp   Type System