Lisp's uniform, parenthesized syntax (known as S-Expressions) works abnormally able-bodied with macros. Languages of the Lisp family, such as Common Lisp, Clojure, Scheme, ISLISP and Racket, accept able macro systems because the syntax is simple abundant to be parsed easily, authoritative it accessible to attention programs as ascribe and achievement abstracts for affairs transformers. Lisp macros transform the affairs anatomy itself, with the abounding accent accessible to accurate such transformations.
The ancient Lisp macros took the anatomy of FEXPRs, function-like operators whose inputs were not the ethics computed by the arguments but rather the syntactic forms of the arguments, and whose achievement were syntactic bits to be acclimated in abode of the FEXPR's use.
In after Lisps, FEXPRs were replaced by DEFMACRO, a arrangement that accustomed programmers to specify source-to-source transformations that were activated afore the affairs is run.
In the mid-eighties, a cardinal of papers67 alien the angle of aseptic macro amplification (syntax-rules), a pattern-based arrangement area the syntactic environments of the macro analogue and the macro use are distinct, acceptance macro definers and users not to anguish about careless capricious abduction (cf. Referential transparency).
Macro systems accept a ambit of uses. Being able to accept the adjustment of appraisal (see apathetic appraisal and non-strict functions) enables the conception of fresh syntactic constructs (e.g. ascendancy structures) duplicate from those congenital into the language. For instance, in a Lisp accent that has cond but lacks if, it is accessible to ascertain the closing in agreement of the above appliance macros.
Next, macros accomplish it accessible to ascertain abstracts languages that are anon aggregate into code, which agency that constructs such as accompaniment machines can be implemented in a way that is both accustomed and efficient.8
Macros can additionally be acclimated to acquaint fresh bounden constructs. The best acclaimed archetype is the transformation of let into the appliance of a action to a set of arguments.
Felleisen conjectures9 that these three categories accomplish up the primary accepted uses of macros in such a system.
The Racket accent extends the angle of a macro arrangement to a syntactic tower, area macros can be accounting in languages including macros, appliance hygiene to ensure that syntactic layers are audible and acceptance modules to consign macros to added modules.
The ancient Lisp macros took the anatomy of FEXPRs, function-like operators whose inputs were not the ethics computed by the arguments but rather the syntactic forms of the arguments, and whose achievement were syntactic bits to be acclimated in abode of the FEXPR's use.
In after Lisps, FEXPRs were replaced by DEFMACRO, a arrangement that accustomed programmers to specify source-to-source transformations that were activated afore the affairs is run.
In the mid-eighties, a cardinal of papers67 alien the angle of aseptic macro amplification (syntax-rules), a pattern-based arrangement area the syntactic environments of the macro analogue and the macro use are distinct, acceptance macro definers and users not to anguish about careless capricious abduction (cf. Referential transparency).
Macro systems accept a ambit of uses. Being able to accept the adjustment of appraisal (see apathetic appraisal and non-strict functions) enables the conception of fresh syntactic constructs (e.g. ascendancy structures) duplicate from those congenital into the language. For instance, in a Lisp accent that has cond but lacks if, it is accessible to ascertain the closing in agreement of the above appliance macros.
Next, macros accomplish it accessible to ascertain abstracts languages that are anon aggregate into code, which agency that constructs such as accompaniment machines can be implemented in a way that is both accustomed and efficient.8
Macros can additionally be acclimated to acquaint fresh bounden constructs. The best acclaimed archetype is the transformation of let into the appliance of a action to a set of arguments.
Felleisen conjectures9 that these three categories accomplish up the primary accepted uses of macros in such a system.
The Racket accent extends the angle of a macro arrangement to a syntactic tower, area macros can be accounting in languages including macros, appliance hygiene to ensure that syntactic layers are audible and acceptance modules to consign macros to added modules.
No comments:
Post a Comment