Parse results, analysis results, and transformation results are generic instances of IStrategoTerm. This becomes unhandy, when later stages need to access this AST in Java. Language-specific Java classes support a more natural representation.

There are several use cases, which require different features. Analyses and transformations in Java typically require visitors (JJForester-style). When the AST should be accessed in Java, but later also passed to a Spoofax transformation, the Java classes need to implement the IStrategoTerm interface. For a Truffle interpreter, the Java classes need to be integrated into the Truffle API class hierarchy.

In general, the Java classes can be generated from the SDF3 syntax definition. However, this might result in unnatural structures. Alternatively, the Java classes can be generated from a separate specification (similar to an Ecore meta-model). This requires a mapping between Stratego terms and Java objects, similar to the ones we saw in Oskar's work.

Submitted by Guido Wachsmuth on 28 June 2016 at 15:01

Log in to post comments