Search in sources :

Example 1 with LitmusX86Parser

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

the class ParserLitmusX86 method parse.

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

Aggregations

ParserErrorListener (com.dat3m.dartagnan.exception.ParserErrorListener)1 LitmusX86Lexer (com.dat3m.dartagnan.parsers.LitmusX86Lexer)1 LitmusX86Parser (com.dat3m.dartagnan.parsers.LitmusX86Parser)1 ProgramBuilder (com.dat3m.dartagnan.parsers.program.utils.ProgramBuilder)1 VisitorLitmusX86 (com.dat3m.dartagnan.parsers.program.visitors.VisitorLitmusX86)1 Program (com.dat3m.dartagnan.program.Program)1