Skip to content
Snippets Groups Projects
rschoene's avatar
René Schöne authored
- Changed error message for invalid redefinition
5fbb5a86
History

RelAST Preprocessor Version 0.2.3

RelAST process

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

./gradlew jar

This will produce build/libs/relast.jar. Copy it to your project and extend your build config (preferably Gradle) with the following:

task preprocess(type: JavaExec) {
    group = 'Build'
    main = "-jar"
    args = [
            "libs/relast.jar",
            "./src/main/jastadd/main.relast",
            "--listClass=RefList",
            "--jastAddList=JastAddList",
            "--file"
    ]

    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;
A.b?   -> B;
A.bs*  -> B;
B      <- A.b  ;
B      <- A.b? ;
B      <- A.bs*;

// Bidirectional relations
A.b   <-> B.a;
A.b   <-> B.a?;
A.b   <-> B.as*;
A.b?  <-> B.a;
A.b?  <-> B.a?;
A.b?  <-> B.as*;
A.bs* <-> B.a;
A.bs* <-> B.a?;
A.bs* <-> B.as*;