Hi,

I’m currently working in the Stratego editor plugin project. What i would like to do is create a builder that takes a Stratego file and produces Stratego Core.

My question is how could i invoke STRJ from inside a strategy:

java -jar strategoxt.jar -i SOMEFILE -F -O 0

and get the resulting AST back. So something like:

to-stratego-core = ?filepath; INVOKE-STRJ

I’m sure this is documented somewhere but i cannot find it. Any help appreciated.

Thanks.

Submitted by Vlad Vergu on 27 November 2010 at 13:05

On 27 November 2010 at 14:07 Lennart Kats closed this issue.

On 27 November 2010 at 14:07 Lennart Kats commented:

The Stratego compiler is encapsulated in the libstrc library (see e.g. https://svn.strategoxt.org/repos/StrategoXT/strategoxt/trunk/strc-core/lib/stratego/strc/strc/strc.str). I don’t think there’s one single strategy to do exactly what you want here though, other than the main entry point of the compiler. On the Java platform, you can use the standard “call” strategy to call external, native executables, but you can also call other Stratego programs in the same class loader using the following calling convention:


(“org.strategoxt.strc.strc-strc”, [“-i”, SOMEFILE, “-F”, “-O”, “0”])
// or
(“org.strategoxt.strj.main-strj”, [“-i”, SOMEFILE, “-F”, “-O”, “0”])

Note that for org.strategoxt.strj you probably need to add it to the build.main.xml file as an -la option. Also, you can also specify the --cache-dir option to improve performance a bit; by default I think that should be `$[[]/.cache] in the editor.

hth

Log in to post comments