[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: macros vs. blocks
I think most should read the following paper to have a wider perspective
We present our experiences with a syntax macro language which we claim
forms a general abstraction mechanism for growing (domain-specific)
extensions of programming languages. Our syntax macro language is
designed to guarantee type safety and termination.
A concept of metamorphisms allows the arguments of a macro to be
inductively defined in a meta level grammar and morphed into the host
language. We also show how the metamorphisms can be made to operate
simultaneously on multiple parse trees at once. The result is a highly
flexible mechanism for growing new language constructs without resorting
to compile-time programming. In fact, whole new languages can be defined
at surprisingly low cost.
This work is fully implemented as part of the <bigwig> system for
defining interactive Web services, but could find use in many other
The result is a very interesting way to extend the syntax of a language.
Basically, the facility provides the programmer with the option to
extend the grammar of a language at all levels in the grammar. This
gives the power of defining domain specific languages with "natural"
syntax that is very close to what you would define if you were
developing a DSL from scratch.
Asger Alstrup Nielsen