|
This challenge involves adding a new language feature to an exisiting language and to adapt supporting tools to that feature. Consider extending Java 1.4 with the enhanced for statement as introduced in Java 5. The statement contains a new local variable declaration, an expression that must be iterable, and a block to be executed each iteration.
More details
- There are several phases in the compiler front-end that need to be extended, e.g., name binding needs to take the new declaration into account, and type checking needs to ensure that the expression to iterate over is actually iterable.
- The backend needs new code generation, or at least translation into the base language.
- Syntax highlighting may need to be extended to support the new syntax.
- The for-statement introduces a new declaration that should be shown in a method outline.
- Context-sensitive help should be provided for the new langauge construct, e.g., new bindings or the expected type for the collection expression.
- Control-flow analysis in a refactoring tool needs to be extended to support the new loop construct.
The challenge is to extend an entire tool chain to support the new language construct. This kind of extension will most often cross-cut the existing decomposition. If, for instance, the tools are implemented using a layered architecture then the new langauge feature will require changes to multiple layers. How can these changes be carried out in a modular fashion? Can we compose several such extensions? What kind of language mechanisms are needed in the framework to support this kind of extensions?
This challenge problem was written by TorbjornEkman. |