diff --git a/README.md b/README.md index 68b7a36ad7a96cdf13ddfb074b7d5616a8a70b65..b0ea1b062a9b60325497738263b50c240929e18f 100644 --- a/README.md +++ b/README.md @@ -1,24 +1,42 @@ # RelAST Preprocessor -Run preprocessor on train benchmark (output written to standard output): + - $ ./gradlew jar - $ cat examples/TrainBenchmark.relast - $ java -jar relast-compiler.jar examples/TrainBenchmark.relast - $ java -jar build/libs/relast.jar examples/TrainBenchmark.relast +The RelAST preprocessor takes a `.relast` file as input comprising AST rules and relations. It produces files that afterwards are processed by JastAdd to generated Java code. +To use it in your project, build the JAR file running -Run preprocessor and write output to files: +``` - $ java -jar build/libs/relast.jar examples/TrainBenchmark.relast --file - $ cat examples/TrainBenchmarkGen.ast - $ cat examples/TrainBenchmarkGen.jadd +./gradlew jar +``` -Run test cases: +This will produce `build/libs/relast.jar`. Copy it to your project and extend your build config (preferably Gradle) with the following: - $ cd test - $ make +``` +task preprocess(type: JavaExec) { + group = 'Build' + main = "-jar" + args = [ + "libs/relast.jar", + "./src/main/jastadd/main.relast", + "--listClass=RefList", + "--jastAddList=JastAddList", + "--file" + ] -Supported relations: + inputs.files file("./src/main/jastadd/main.relast") + outputs.files file("./src/main/jastadd/mainGen.ast"), file("./src/main/jastadd/mainGen.jadd") +} +``` + +Note that you may have to change + +- the directory of `relast.jar` +- the `.relast` file(s) both as argument(s) and input file(s) +- the output files +- parameters of RelAST (in this case, the list classes were renamed) + +## Supported relations // Directed relations A.b -> B; diff --git a/relast-process.png b/relast-process.png new file mode 100644 index 0000000000000000000000000000000000000000..e3dda55dbd8e7a3bcb98207e8c81f52f4a682d10 Binary files /dev/null and b/relast-process.png differ