Java-front is a package you can use to generate or transform Java code. It contains a handcrafted SDF grammar for Java, Stratego signatures generated from this grammar and a handcrafted pretty printer.

Some of the unique features of Java-front are:

  • Modular and extensible syntax definition for Java
  • Full support for the new language features introduced in Java 5.0
  • Heavily tested pretty-printer, which inserts parentheses where necessary!
  • Option to preserve comments
  • Conversion of abstract syntax tree to XML possible

Available Versions of Java

Java-front supports Java 5.0. The syntax definition closely follows the structure of the Java Language Specifcation, Third Edition (JLS3). All new features (generics, wildcards, varargs, static import, enums, foreach loop, annotations) are supported. This syntax definition is called Java-15.

Quality and Compliance

The Java grammar in Java-front is able to parse and pretty-print all the Java sources in the GNU Classpath (over 2200 classes) and the Java 2 SDK version 1.5.0 of Sun Microsystems (over 6500 classes). The results of the pretty-printer are verified.

A note on compliance: SDF assumes an ASCII world. This means that only ASCII input characters are supported. Fortunately, most sources do not use unescaped characters outside the ASCII range, so this is not a big problem in practice.



Java-front has been used for the following research publications:

  • Lennart C. L. Kats, Martin Bravenboer, and Eelco Visser. Mixing Source and Bytecode. A Case for Compilation by Normalization. In Proceedings of the 23st ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA 2008), Nashville, Tennessee, USA, October 2008. (pdf)

  • Martin Bravenboer, Éric Tanter, and Eelco Visser. Declarative, Formal, and Extensible Syntax Definition for AspectJ - A Case for Scannerless Generalized-LR Parsing. In Proceedings of the 21st ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA 2006), Portland, USA, October 2006. (pdf)

  • Eric Tanter. An Extensible Kernel Language for AOP. In Proceedings of the AOSD Workshop on Open and Dynamic Aspect Languages (ODAL 2006). March 2006, Bonn, Germany.

  • Mina Askari and Raihan Al-Ekram. Bringing Smalltalk Blocks to Java Through Transformation Techniques. 2005 IBIMA Conference on Theory and Practice of Software Engineering for the 21st Century (TPSE 2005). Cairo, Egypt. December 13 - 15, 2005 (pdf)

  • Martin Bravenboer, Rob Vermaas, Jurgen Vinju and Eelco Visser. Generalized Type-Based Disambiguation of Meta Programs with Concrete Object Syntax. In Proceedings of the Fourth International Conference on Generative Programming and Component Engineering (GPCE 2005), Tallinn, Estonia, September 2005. (pdf, presentation)

  • Anya Helene Bagge, Martin Bravenboer, Karl Trygve Kalleberg, Koen Muilwijk, and Eelco Visser. Adaptive Code Reuse by Aspects, Cloning and Renaming. Technical Report UU-CS-2005-031, Department of Information and Computing Sciences, Universiteit Utrecht, Utrecht, The Netherlands, August 2005. (pdf)

  • Martin Bravenboer, Rene de Groot, and Eelco Visser. MetaBorg in Action: Examples of Domain-specific Language Embedding and Assimilation using Stratego/XT. In Proceedings of the Summer School on Generative and Transformational Techniques in Software Engineering (GTTSE 2005), Braga, Portugal, July, 2005. (draft: pdf)

  • Martin Bravenboer and Eelco Visser. Concrete Syntax for Objects. Domain-Specific Language Embedding and Assimilation without Restrictions. In Douglas C.Schmidt (ed.) Proceedings of the 19th ACM SIGPLAN conference on Object-Oriented Programing, Systems, Languages, and Applications (OOPSLA'04). Vancouver, Canada. October 2004. (pdf)


Stable Releases

The current release is:

Older releases:

Latest Developments

Distributions (tarball, rpm, srpm) of the head revision are created continuously:

The distributions contain the latest of the latest developments, but if you really want to, the latest sources can be checked out using:

  svn checkout https://svn.strategoxt.org/repos/StrategoXT/java-front/trunk
Before you can configure the package as described above you have to run the ./bootstrap script.


Install the package with the usual sequence of commands:

$ ./configure
$ make
$ make install

You might need to set your PKG_CONFIG_PATH if you did not install the dependencies in a standard location. Configure will tell you to do this if it cannot find aterm, sdf or strategoxt.

Project Info

Issue Tracking

We use JIRA to keep track of issues. Please report any issues that you encounter!

Contact and Mailing List

Please send questions to the users@strategoxt.org mailing list. Also, the Java-front developers are usually available on IRC at irc.freenode.net/stratego. Feel free to drop by!

Source Repository

The sources of Java-front are available from Subversion.



Feedback and bug reports:



Java-front is LGPL (GNU Lesser General Public License) software.

Related Software

  • Java-borg, which is based on Java-front, illustrates how to implement Java extensions.

  • Dryad is a set of Java compiler components. The application of these components is not restricted to compilers: Java program transformations profit from the disambiguation and semantics analysis components in Dryad. Dryad is based on Java-front.

  • AspectJ-front provides a syntax definition and parser for AspectJ. AspectJ-front is based on Java-front.

  • Jimple-front provides support for the Jimple 3-address representation of Java bytecode, which is a useful representation for program analysis and transformation.

Revision: r1.58 - 11 Oct 2011 - 11:01 - KarlTrygveKalleberg
Copyright © 1999-2020 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback