Search in sources :

Example 1 with LitmusCParser

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

the class ParserLitmusC method parse.

@Override
public Program parse(CharStream charStream) {
    LitmusCLexer lexer = new LitmusCLexer(charStream);
    CommonTokenStream tokenStream = new CommonTokenStream(lexer);
    LitmusCParser parser = new LitmusCParser(tokenStream);
    parser.setErrorHandler(new BailErrorStrategy());
    ProgramBuilder pb = new ProgramBuilder(SourceLanguage.LITMUS);
    ParserRuleContext parserEntryPoint = parser.main();
    VisitorLitmusC visitor = new VisitorLitmusC(pb);
    Program program = (Program) parserEntryPoint.accept(visitor);
    program.setArch(Arch.LKMM);
    return program;
}
Also used : LitmusCLexer(com.dat3m.dartagnan.parsers.LitmusCLexer) Program(com.dat3m.dartagnan.program.Program) LitmusCParser(com.dat3m.dartagnan.parsers.LitmusCParser) ProgramBuilder(com.dat3m.dartagnan.parsers.program.utils.ProgramBuilder) VisitorLitmusC(com.dat3m.dartagnan.parsers.program.visitors.VisitorLitmusC)

Aggregations

LitmusCLexer (com.dat3m.dartagnan.parsers.LitmusCLexer)1 LitmusCParser (com.dat3m.dartagnan.parsers.LitmusCParser)1 ProgramBuilder (com.dat3m.dartagnan.parsers.program.utils.ProgramBuilder)1 VisitorLitmusC (com.dat3m.dartagnan.parsers.program.visitors.VisitorLitmusC)1 Program (com.dat3m.dartagnan.program.Program)1