Search in sources :

Example 1 with LitmusPPCLexer

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

the class ParserLitmusPPC method parse.

@Override
public Program parse(CharStream charStream) {
    LitmusPPCLexer lexer = new LitmusPPCLexer(charStream);
    CommonTokenStream tokenStream = new CommonTokenStream(lexer);
    LitmusPPCParser parser = new LitmusPPCParser(tokenStream);
    parser.addErrorListener(new DiagnosticErrorListener(true));
    parser.addErrorListener(new ParserErrorListener());
    ProgramBuilder pb = new ProgramBuilder(SourceLanguage.LITMUS);
    ParserRuleContext parserEntryPoint = parser.main();
    VisitorLitmusPPC visitor = new VisitorLitmusPPC(pb);
    Program program = (Program) parserEntryPoint.accept(visitor);
    program.setArch(Arch.POWER);
    return program;
}
Also used : VisitorLitmusPPC(com.dat3m.dartagnan.parsers.program.visitors.VisitorLitmusPPC) Program(com.dat3m.dartagnan.program.Program) ProgramBuilder(com.dat3m.dartagnan.parsers.program.utils.ProgramBuilder) LitmusPPCLexer(com.dat3m.dartagnan.parsers.LitmusPPCLexer) LitmusPPCParser(com.dat3m.dartagnan.parsers.LitmusPPCParser) ParserErrorListener(com.dat3m.dartagnan.exception.ParserErrorListener)

Aggregations

ParserErrorListener (com.dat3m.dartagnan.exception.ParserErrorListener)1 LitmusPPCLexer (com.dat3m.dartagnan.parsers.LitmusPPCLexer)1 LitmusPPCParser (com.dat3m.dartagnan.parsers.LitmusPPCParser)1 ProgramBuilder (com.dat3m.dartagnan.parsers.program.utils.ProgramBuilder)1 VisitorLitmusPPC (com.dat3m.dartagnan.parsers.program.visitors.VisitorLitmusPPC)1 Program (com.dat3m.dartagnan.program.Program)1