Search in sources :

Example 1 with LustreLexer

use of jkind.lustre.parsing.LustreLexer 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 LustreLexer

use of jkind.lustre.parsing.LustreLexer 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)));
}
Also used : LustreToAstVisitor(jkind.lustre.parsing.LustreToAstVisitor) CommonTokenStream(org.antlr.v4.runtime.CommonTokenStream) LustreParser(jkind.lustre.parsing.LustreParser) ANTLRFileStream(org.antlr.v4.runtime.ANTLRFileStream) Program(jkind.lustre.Program) IdExpr(jkind.lustre.IdExpr) LustreLexer(jkind.lustre.parsing.LustreLexer) Evaluator(edu.uah.rsesc.aadlsimulator.agree.eval.Evaluator)

Aggregations

Program (jkind.lustre.Program)2 LustreLexer (jkind.lustre.parsing.LustreLexer)2 LustreParser (jkind.lustre.parsing.LustreParser)2 LustreToAstVisitor (jkind.lustre.parsing.LustreToAstVisitor)2 ANTLRFileStream (org.antlr.v4.runtime.ANTLRFileStream)2 CommonTokenStream (org.antlr.v4.runtime.CommonTokenStream)2 GenerateUfcObligationsVisitor (com.rockwellcollins.atc.tcg.lustre.visitors.GenerateUfcObligationsVisitor)1 Evaluator (edu.uah.rsesc.aadlsimulator.agree.eval.Evaluator)1 PrintWriter (java.io.PrintWriter)1 IdExpr (jkind.lustre.IdExpr)1