use of jkind.lustre.parsing.LustreParser in project AGREE by loonwerks.
the class StandaloneTcg method main.
public static void main(String[] args) throws IOException {
// Parse command line arguments
final Arguments appArgs = Arguments.parse(args);
if (appArgs == null) {
System.err.println("Usage: java -jar tcg.jar [options] <input_filename> <output_filename>");
System.err.println("Options:");
System.err.println(Arguments.OPTION_GENERATE_BOUNDARY_VALUE_TESTS + " Enables generation of boundary value tests.");
return;
}
// Parse the lustre file
final LustreLexer lexer = new LustreLexer(new ANTLRFileStream(appArgs.inputFilename));
final CommonTokenStream tokens = new CommonTokenStream(lexer);
final LustreParser parser = new LustreParser(tokens);
final Program program = new LustreToAstVisitor().program(parser.program());
// Process it
final GenerateUfcObligationsVisitor visitor = new GenerateUfcObligationsVisitor(program, null);
visitor.setGenerateAssumptionObligations(false);
visitor.setGenerateEqObligations(false);
visitor.setGenerateGuaranteeObligations(false);
visitor.setGenerateBoundaryValueTests(appArgs.enableBoundaryValueTests);
visitor.setGeneratePropertyObligations(true);
program.accept(visitor);
// Construct the new program
final Program outProgram = visitor.constructNewProgram();
// Write output
try (PrintWriter out = new PrintWriter(appArgs.outputFilename)) {
out.println(outProgram);
}
}
use of jkind.lustre.parsing.LustreParser in project AGREE by loonwerks.
the class Main method createEvaluator.
private static Evaluator createEvaluator(final String lustreFilepath) throws IOException {
final LustreLexer lexer = new LustreLexer(new ANTLRFileStream(lustreFilepath));
final CommonTokenStream tokens = new CommonTokenStream(lexer);
final LustreParser parser = new LustreParser(tokens);
final Program program = new LustreToAstVisitor().program(parser.program());
final Evaluator evaluator = new Evaluator(program);
return new Evaluator(evaluator, Collections.singleton(new IdExpr(CreateSimulationGuarantee.SIMULATION_ASSERTIONS_ID)));
}
Aggregations