Search in sources :

Example 1 with BoogieParser

use of com.dat3m.dartagnan.parsers.BoogieParser in project Dat3M by hernanponcedeleon.

the class ParserBoogie method parse.

@Override
public Program parse(CharStream charStream) {
    BoogieLexer lexer = new BoogieLexer(charStream);
    CommonTokenStream tokenStream = new CommonTokenStream(lexer);
    BoogieParser parser = new BoogieParser(tokenStream);
    parser.addErrorListener(new ParserErrorListener());
    ProgramBuilder pb = new ProgramBuilder(SourceLanguage.BOOGIE);
    ParserRuleContext parserEntryPoint = parser.main();
    VisitorBoogie visitor = new VisitorBoogie(pb);
    Program program = (Program) parserEntryPoint.accept(visitor);
    return program;
}
Also used : BoogieLexer(com.dat3m.dartagnan.parsers.BoogieLexer) Program(com.dat3m.dartagnan.program.Program) ProgramBuilder(com.dat3m.dartagnan.parsers.program.utils.ProgramBuilder) BoogieParser(com.dat3m.dartagnan.parsers.BoogieParser) VisitorBoogie(com.dat3m.dartagnan.parsers.program.visitors.boogie.VisitorBoogie) ParserErrorListener(com.dat3m.dartagnan.exception.ParserErrorListener)

Aggregations

ParserErrorListener (com.dat3m.dartagnan.exception.ParserErrorListener)1 BoogieLexer (com.dat3m.dartagnan.parsers.BoogieLexer)1 BoogieParser (com.dat3m.dartagnan.parsers.BoogieParser)1 ProgramBuilder (com.dat3m.dartagnan.parsers.program.utils.ProgramBuilder)1 VisitorBoogie (com.dat3m.dartagnan.parsers.program.visitors.boogie.VisitorBoogie)1 Program (com.dat3m.dartagnan.program.Program)1