Macro (computer Science) - Syntactic Macros

Macro systems that work at the level of abstract syntax trees are called syntactic macros and preserve the lexical structure of the original program. Meanwhile, macro systems, such as the C preprocessor described earlier, that work at the level of lexical tokens cannot preserve the lexical structure reliably. The most widely used implementations of syntactic macro systems are found in Lisp-like languages such as Common Lisp, Scheme, ISLISP and Racket. These languages are especially suited for this style of macro due to their uniform, parenthesized syntax (known as S-Expressions). In particular, uniform syntax makes it easier to determine the invocations of macros. Lisp macros transform the program structure itself, with the full language available to express such transformations. While syntactic macros are most commonly found in Lisp-like languages, they have been implemented for other languages such as Dylan, Scala, and Nemerle.

Read more about this topic:  Macro (computer Science)

Famous quotes containing the word syntactic:

    The syntactic component of a grammar must specify, for each sentence, a deep structure that determines its semantic interpretation and a surface structure that determines its phonetic interpretation.
    Noam Chomsky (b. 1928)