AbleJ is an extensible language framework for Java 1.4 that can be easily extended with domain specific language features to define new ``domain-adapted´´ versions of Java. Such languages raise the level of abstraction of the language to that of a particular problem, even when the problem crosses multiple domains.
This tool demonstration accompanies our paper "Attribute Grammar-based Language Extensions for Java" in the main ECOOP program. It shows how one can use ableJ 1.4 to define (domain specific) language extensions that specify the syntax, semantic analyses (e.g. for error-checking), and optimizations of the new language constructs. We also show how to compose several language extensions developed by different parties to create a new customized extended language. In the case of many extensions, including those described below, this composition process can be done automatically. Thus no implementation level knowledge of the language extensions is needed to create new extended languages.
We will discuss several language extensions to highlight the capabilities of ableJ. The first embeds the SQL query language into Java so that database queries can be written in a natural syntax and syntax and type errors can be detected at compile time. The second adds efficient numerical types for computational geometry. It provides semantic analysis that is used to generate efficient unbounded integers and transformations for handling data degeneracies. The third adds general purpose features such as algebraic types and pattern matching as defined in the Pizza language and the fourth extension adds several Java 1.5 features to the Java 1.4 host language. These include the enhanced for-loop, enumerated types, and auto boxing and unboxing. Generics are also discussed as a modular extension to ableJ1.4.
In ableJ, the host language Java and the language extensions are defined as attribute grammars written in Silver, an attribute grammar specification language that has a number of enhancements that facilitate the high degree of modularity needed to automatically compose language extensions. To address the challenges of parsing and scanning extended languages we have developed a novel approach in which a modified LR parser passes to the scanner the set of terminals are valid for a current parse state. The scanner uses this information to disambiguate terminals whose defining regular expressions overlap. Extended languages created from all of the extensions listed above are deterministically parsed and scanned using this approach.