Todd A. Proebsting and David R. Hanson. MSR-2003-32
This paper describes a new C# compiler designed specifically to provide that infrastructure. The overall design is deceptively simple. The parser is generated automatically from a possibly ambiguous grammar, accepts C# source, perhaps with new features, and produces an abstract syntax tree, or AST. Subsequent phases (dubbed visitors) traverse the AST, perhaps modifying, annotating it or emitting output, and pass it along to the next visitor. Visitors are specified entirely at compilation time and are loaded dynamically as needed. There is no fixed set of visitors, and visitors are completely unconstrained.
Being able to reason about language behaviour based solely on abstract semantics is like having perfect pitch in music: immensly useful if you are a composer (or language designer) but extremely rare in the poplulation. Practice helps, but not much.
That's why definitional interpreters are so useful: they allow you to experiment with language constructs, and language design ideas. Want to see if your new construct should have dynamic scope? Make the change, and see what happens.
This work follows this standard approach, even if it deals with a compilation system (is that just a fancy way to say compiler?) Obviously, the focus here is on compile time facilites and not run time behvaiour, and indeed the authors confess that most usage to date has been for tools, not for language design experiments. Still, via the magic of source-to-source transformations real language design work can also be done.
Posted to implementation by Ehud Lamm on 10/19/03; 12:06:14 PM