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;
}
}
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;
}
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;
}
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);
}
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");
}
Aggregations