How do I call Java functions from Stratego?
Asked by Eelco Visser on 25 March 2013 at 15:41
3 Answers
You have to wrap them as Stratego strategies. If you generate a new
project, theeditor/java/YOURLANGUAGE/strategies/java_strategy_0_0.java
class gives
an example. If you want to add strategies to an existing Spoofax
project, you can add further strategy classes to the same directory:Answered by Eelco Visser on 25 March 2013 at 15:41
- Create a new class that extends `Strategy`, following the template
of `java_strategy_0_0.java`- Add a reference to that class in
InteropRegisterer.java
In addition to Eelco’s answer, if you have any dependencies other than the standard Spoofax dependencies, you can add them to the plugin.xml file of your project (https://yellowgrass.org/issue/Spoofax/322). If you open that file in Eclipse, you can add them to the “dependencies” tab. For example, you can add EMF as a dependency this way.
Answered by Lennart Kats on 25 March 2013 at 15:52
And there’s a wiki page about this here.
Answered by Vlad Vergu on 25 March 2013 at 16:06