Modular Domain-Specific Language Extensions
چکیده
Software development is a time-consuming, and error-prone process. A significant part of the problem is caused by the large semantic gap between the programmer’s high-level understanding of the problem and the relatively low-level language in which the problem solutions are encoded. General purpose language features such as generics in object-oriented programming or higher-order functions are helpful in specifying abstractions for a specific problem or domain, but these are limited in that they only provide the functionality of the desired abstractions. Domain-specific languages [6] can provide this same functionality but they also provide language constructs (notations) for the (domain-specific) abstractions and thus help reduce this semantic gap by raising the level of abstraction of the language to that of a specific domain. These languages also provide domain-specific analyses and optimizations that are difficult, if not impossible, to specify for programs written in general purpose languages. But the fundamental issue remains since problems often cross multiple domains and no language contains all of the general-purpose and domain-specific features needed to address every aspect of the problem. Thus, programmers cannot “say what they mean” but must encode their ideas as programming idioms at a lower level of abstraction. It is our position that extensible languages provide a promising way to improve the software development process and software quality by reducing the semantic gap. An extensible language can easily be extended with the unique combination of domain-specific language features that raise the level of abstraction to that of a particular problem, even when the problem crosses multiple domains. A framework for language extensibility should have two significant facets. First, it should satisfy the requirement of completeness, that is, it should allow any language extension to fit seamlessly into the host language and be as welldeveloped as the host language constructs. In particular, the feature designer should be able to specify new language constructs together with their domain-specific semantic analyses and techniques for their optimization. Second, the extensibility framework should be modular in that it should allow a programmer to extend a language by choosing from a collection of previously defined features knowing only the functionality they provide. To understand the extensibility we seek, a distinction is made between the activities of implementing a language extension, performed by a domain-expert feature designer, and using language extensions to create an extended language, performed by a programmer.