Java Front 0.9

Stratego -- Strategies for Program Transformation

Released July, 2009

Download

Java Front 0.9 requires Stratego/XT 0.17.

Source tar.gz

SuSE Linux RPM

SuSE 11.0:

SuSE 10.3:

Fedora Core RPM

Fedora Core 11:

Fedora Core 10:

Fedora Core 9:

Fedora Core 5:

Debian DEB

Debian 5.0:

Debian 4.0:

Ubuntu DEB

Ubuntu 9.04:

Ubuntu 8.10:

Ubuntu 8.04:

Nix Package

One-click installation using Nix, open with nix-install-package

License

Stratego/XT Utilities is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

News

This is a minor update of Java-front, a package that provides the syntax-related support for implementing Java transformation systems.

Wrapper strategies for Java to Java transformation tools

Added the long requested wrapper strategies for creating Java to Java transformation tools.

    io-java2java-wrap(s) =
    io-java2java-wrap(extra-opts, s) =
    io-java2java-wrap(extra-opts, usage, about, s) =

Creating a source to source tool is now as easy as:

    module foo
    imports libstratego-lib libjava-front
    strategies

    main =
      io-java2java-wrap(foo)
 
    foo =
    // some AST transformation

  $ strc -i foo.str $(strcflags stratego-lib java-front)
  $ ./foo -i Foo.java -o Bar.java

Pretty printer available as library

The java-front pretty-printer can now be used as a separately compiled library.

Java embedding

Renovation of the Java embedding definitions. The preferred embedding is now no longer using a prefixed version of Java, but a mix version of Java.

The preferred definition for embedding Java is now EmbeddedJavaMix?.def. This module is parameterized with two symbols:

  • The context of Java.
  • The expression non-terminal of the host language.

If you use StrategoRenamed?, then the import can be something like this:

  languages/java/EmbeddedJavaMix[Java StrategoTerm]

The advantage of having EmbeddedJavaMix? is that you can easily embed multiple languages, even if more than one of these languages involve Java. Suppose that you have a language Foo that extends Java:

  module Foo
  imports
  languages/java/JavaMix[Foo] 
  
  exports
  ...

and Foo is embedded in Stratego:

  module StrategoFoo
  imports
  languages/stratego/StrategoMix[Stratego]
  Foo

  exports
  ...

In this situation the composer of the embeddings can decide if he (she is unlikely) wants to support the variables and anti-quotations in Foo quotations and if Foo constructs should be supported in Java quotations.

If this should be allowed, then EmbeddedJavaMix? can be imported with the parameters [Foo TermStratego?]. If this should not be allowed, then a different first parameter can be chosen.

AST changes

There have been some minor changes is the syntax definition that change the Java AST to previous versions, and therefore might break existing code.

  • Replaced ClassName? with TypeName?. This changes the representation of:
    • Qualified super field access
    • Qualified super method invocation
    • Qualified this.
  • All these constructs are now qualified by a TypeName? instead of a ClassName?.
  • Change in modifiers: Anno is no longer a Mod
  • GenericStaticMethod? has been renamed to GenericMethod? and the prefix of the GenericMethod? is now an AmbName?, not a TypeName?. This represents the syntactical ambiguity better.

Contributors

  • Martin Bravenboer
  • Eelco Dolstra
  • Eelco Visser
  • Lennart Kats
  • Danny Groenwegen
  • Rob Vermaas

Thanks!