Search in sources :

Example 1 with VisitorXML

use of com.dat3m.dartagnan.parsers.witness.visitors.VisitorXML in project Dat3M by hernanponcedeleon.

the class ParserWitness method parse.

public WitnessGraph parse(CharStream charStream) {
    XMLLexer lexer = new XMLLexer(charStream);
    CommonTokenStream tokenStream = new CommonTokenStream(lexer);
    XMLParser parser = new XMLParser(tokenStream);
    parser.addErrorListener(new ParserErrorListener());
    ParserRuleContext parserEntryPoint = parser.document();
    VisitorXML visitor = new VisitorXML();
    WitnessGraph graph = (WitnessGraph) parserEntryPoint.accept(visitor);
    if (graph.hasAttributed("producer")) {
        logger.info("Witness graph produced by " + graph.getAttributed("producer"));
    }
    logger.info("Witness graph stats: #Nodes " + graph.getNodes().size());
    logger.info("Witness graph stats: #Edges " + graph.getEdges().size());
    return graph;
}
Also used : CommonTokenStream(org.antlr.v4.runtime.CommonTokenStream) ParserRuleContext(org.antlr.v4.runtime.ParserRuleContext) XMLLexer(com.dat3m.dartagnan.parsers.XMLLexer) XMLParser(com.dat3m.dartagnan.parsers.XMLParser) WitnessGraph(com.dat3m.dartagnan.witness.WitnessGraph) ParserErrorListener(com.dat3m.dartagnan.exception.ParserErrorListener) VisitorXML(com.dat3m.dartagnan.parsers.witness.visitors.VisitorXML)

Aggregations

ParserErrorListener (com.dat3m.dartagnan.exception.ParserErrorListener)1 XMLLexer (com.dat3m.dartagnan.parsers.XMLLexer)1 XMLParser (com.dat3m.dartagnan.parsers.XMLParser)1 VisitorXML (com.dat3m.dartagnan.parsers.witness.visitors.VisitorXML)1 WitnessGraph (com.dat3m.dartagnan.witness.WitnessGraph)1 CommonTokenStream (org.antlr.v4.runtime.CommonTokenStream)1 ParserRuleContext (org.antlr.v4.runtime.ParserRuleContext)1