javamacrosdsldsl-tools

Syntax Preprocessors for Java


I'm looking for a Java macro language that provides for convenient ways of doing closures (that compile to anonymous inner classes) and list comprehension (that compiles down to basic java loops).

An example of the kind of thing I'm looking for would be Xtend2 http://www.eclipse.org/Xtext/#xtend2

But I want something for general purpose programming (Xtend2 is very specific DSL for Xtext and has a ton of dependencies). Maybe even something that would let me define multiple classes in a single file (which would then get split up into two separate files by the pre-processor).

Does anything like this exist?

Edited to add: I'm doing Android development so any alternatives have to generate either valid Java source or the byte code has to be compatible with the dalvik recompiler.


Solution

  • Mmm, there used to be the JSE, which was tremendous fun, back in the day.

    Mirah is cool, but not ready for primetime, IMO.

    You can do a lot with smart templating, although your source view is the Java.

    There's a post on SO about using XTend on Android from a few days ago, too.