Search in sources :

Example 1 with Model

use of org.abs_models.frontend.ast.Model in project abstools by abstools.

the class CoreAbsBackend method mainMethod.

public int mainMethod(Absc args) {
    this.arguments = args;
    try {
        Model m = parse(arguments.files);
        PrintStream stream = System.out;
        String loc = "Standard Output";
        if (arguments.outputfile != null) {
            stream = new PrintStream(arguments.outputfile);
            loc = arguments.outputfile.getAbsolutePath();
        }
        if (arguments.verbose) {
            System.out.println("Generating Core ABS to " + loc + "...");
        }
        m.generateCoreABS(stream);
        return 0;
    } catch (Exception e) {
        printError(e.getMessage());
        return 1;
    }
}
Also used : PrintStream(java.io.PrintStream) Model(org.abs_models.frontend.ast.Model)

Example 2 with Model

use of org.abs_models.frontend.ast.Model in project abstools by abstools.

the class ErlangBackend method compile.

private int compile() throws Exception {
    final Model model = parse(arguments.files);
    if (model.hasParserErrors() || model.hasErrors() || model.hasTypeErrors()) {
        printErrorMessage();
        return 1;
    }
    File outdir = arguments.destDir;
    if (outdir.getPath().equals("gen")) {
        // KLUDGE: "gen/" is the default path for java and erlang;
        // keep old erlang behavior of defaulting to "gen/erl/".
        // Note that we can't generate directly into "gen/" since
        // we don't know if the user explicitly specified "gen/"
        // or didn't say anything about the output directory
        outdir = new File("gen/erl/");
    }
    EnumSet<CompileOptions> compileOptions = EnumSet.noneOf(CompileOptions.class);
    if (arguments.verbose)
        compileOptions.add(CompileOptions.VERBOSE);
    if (arguments.debug)
        compileOptions.add(CompileOptions.DEBUG);
    if (arguments.debug_generated_code)
        compileOptions.add(CompileOptions.COVERAGE);
    compile(model, outdir, compileOptions);
    return 0;
}
Also used : Model(org.abs_models.frontend.ast.Model) File(java.io.File)

Example 3 with Model

use of org.abs_models.frontend.ast.Model in project abstools by abstools.

the class JavaBackend method compile.

private int compile() throws Exception {
    final Model model = parse(arguments.files);
    if (model.hasParserErrors() || model.hasErrors() || model.hasTypeErrors()) {
        printErrorMessage();
        return 1;
    }
    if (!arguments.destDir.mkdirs() && !arguments.destDir.isDirectory()) {
        throw new IOException("Could not create directory " + arguments.destDir.toString());
    }
    if (!arguments.destDir.canWrite()) {
        throw new InternalBackendException("Destination directory " + arguments.destDir.getAbsolutePath() + " cannot be written to!");
    }
    compile(model, arguments.destDir);
    return 0;
}
Also used : InternalBackendException(org.abs_models.backend.common.InternalBackendException) Model(org.abs_models.frontend.ast.Model) IOException(java.io.IOException)

Example 4 with Model

use of org.abs_models.frontend.ast.Model in project abstools by abstools.

the class Tester method compile.

private int compile(String[] args) throws DeltaModellingException, IOException, WrongProgramArgumentException, InternalBackendException {
    // initialize numberOfIterations, fixpointVersion
    List<String> upstreamArgs = this.parseArgs(args);
    Absc absc = Absc.parseArgs(upstreamArgs.toArray(new String[0]));
    this.arguments = absc;
    final Model model = this.parse(arguments.files);
    if (model.hasParserErrors() || model.hasErrors() || model.hasTypeErrors()) {
        return 127;
    }
    if (arguments.verbose) {
        System.out.println("Starting deadlock analysis...");
    }
    /*Instantiate the analyzer and perform deadlock analysis*/
    Analyser a = new Analyser();
    return a.deadlockAnalysis(model, arguments.verbose, numberOfIterations, fixpointVersion, System.out);
}
Also used : Model(org.abs_models.frontend.ast.Model) Absc(org.abs_models.Absc)

Example 5 with Model

use of org.abs_models.frontend.ast.Model in project abstools by abstools.

the class DeltaOrderingTest method circularOrder2.

@Test(expected = DeltaModellingException.class)
public void circularOrder2() throws DeltaModellingException, WrongProgramArgumentException {
    Model model = assertParse("module M;" + "delta D1;" + "delta D2;" + "delta D3;" + "delta D4;" + "productline PL;" + "features A;" + "delta D1 after D2 when A;" + "delta D2 after D1 when A;" + "delta D3 after D1 when A;" + "delta D1 after D4 when A;" + "product P(A);");
    model.evaluateAllProductDeclarations();
    model.flattenForProduct("P");
}
Also used : Model(org.abs_models.frontend.ast.Model) Test(org.junit.Test)

Aggregations

Model (org.abs_models.frontend.ast.Model)268 Test (org.junit.Test)227 FrontendTest (org.abs_models.frontend.FrontendTest)101 ClassDecl (org.abs_models.frontend.ast.ClassDecl)72 DeltaDecl (org.abs_models.frontend.ast.DeltaDecl)34 SemanticConditionList (org.abs_models.frontend.analyser.SemanticConditionList)29 ABSTest (org.abs_models.ABSTest)22 ProductDecl (org.abs_models.frontend.ast.ProductDecl)17 FunctionDecl (org.abs_models.frontend.ast.FunctionDecl)15 HashSet (java.util.HashSet)13 ModifyClassModifier (org.abs_models.frontend.ast.ModifyClassModifier)13 PrintStream (java.io.PrintStream)12 Product (org.abs_models.frontend.ast.Product)11 SkipStmt (org.abs_models.frontend.ast.SkipStmt)11 VarUse (org.abs_models.frontend.ast.VarUse)11 Feature (org.abs_models.frontend.ast.Feature)10 File (java.io.File)9 ExpFunctionDef (org.abs_models.frontend.ast.ExpFunctionDef)9 ReturnStmt (org.abs_models.frontend.ast.ReturnStmt)9 KindedName (org.abs_models.frontend.typechecker.KindedName)9