Search in sources :

Example 1 with GenerateUfcObligationsVisitor

use of com.rockwellcollins.atc.tcg.lustre.visitors.GenerateUfcObligationsVisitor 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);
    }
}
Also used : LustreToAstVisitor(jkind.lustre.parsing.LustreToAstVisitor) CommonTokenStream(org.antlr.v4.runtime.CommonTokenStream) LustreParser(jkind.lustre.parsing.LustreParser) GenerateUfcObligationsVisitor(com.rockwellcollins.atc.tcg.lustre.visitors.GenerateUfcObligationsVisitor) ANTLRFileStream(org.antlr.v4.runtime.ANTLRFileStream) Program(jkind.lustre.Program) LustreLexer(jkind.lustre.parsing.LustreLexer) PrintWriter(java.io.PrintWriter)

Example 2 with GenerateUfcObligationsVisitor

use of com.rockwellcollins.atc.tcg.lustre.visitors.GenerateUfcObligationsVisitor in project AGREE by loonwerks.

the class VerifyHandler method constructUfcProgram.

private Program constructUfcProgram(Program program, TcgRenaming renaming) {
    System.out.println("building ufc obligations...");
    GenerateUfcObligationsVisitor ufcGenerator = new GenerateUfcObligationsVisitor(program, renaming);
    ufcGenerator.setGenerateAssumptionObligations(TcgPreferenceUtils.getGenerateTestsForAssumptions());
    ufcGenerator.setGenerateEqObligations(TcgPreferenceUtils.getGenerateTestsForEquations());
    ufcGenerator.setGenerateBoundaryValueTests(TcgPreferenceUtils.getPerformBoundaryValueChecks());
    ufcGenerator.traverse();
    return ufcGenerator.constructNewProgram();
}
Also used : GenerateUfcObligationsVisitor(com.rockwellcollins.atc.tcg.lustre.visitors.GenerateUfcObligationsVisitor)

Aggregations

GenerateUfcObligationsVisitor (com.rockwellcollins.atc.tcg.lustre.visitors.GenerateUfcObligationsVisitor)2 PrintWriter (java.io.PrintWriter)1 Program (jkind.lustre.Program)1 LustreLexer (jkind.lustre.parsing.LustreLexer)1 LustreParser (jkind.lustre.parsing.LustreParser)1 LustreToAstVisitor (jkind.lustre.parsing.LustreToAstVisitor)1 ANTLRFileStream (org.antlr.v4.runtime.ANTLRFileStream)1 CommonTokenStream (org.antlr.v4.runtime.CommonTokenStream)1