Search in sources :

Example 1 with Relation

use of com.dat3m.dartagnan.wmm.relation.Relation in project Dat3M by hernanponcedeleon.

the class VisitorBase method visitAxiomDefinition.

@Override
public Object visitAxiomDefinition(CatParser.AxiomDefinitionContext ctx) {
    try {
        Relation r = ctx.e.accept(relationVisitor);
        if (r == null) {
            throw new ParsingException(ctx.getText());
        }
        Constructor<?> constructor = ctx.cls.getConstructor(Relation.class);
        wmm.addAxiom((Axiom) constructor.newInstance(r));
    } catch (NoSuchMethodException | InstantiationException | IllegalAccessException | InvocationTargetException e) {
        throw new ParsingException(ctx.getText());
    }
    return null;
}
Also used : RecursiveRelation(com.dat3m.dartagnan.wmm.relation.RecursiveRelation) Relation(com.dat3m.dartagnan.wmm.relation.Relation) ParsingException(com.dat3m.dartagnan.exception.ParsingException) InvocationTargetException(java.lang.reflect.InvocationTargetException)

Example 2 with Relation

use of com.dat3m.dartagnan.wmm.relation.Relation in project Dat3M by hernanponcedeleon.

the class VisitorBase method visitLetRecAndDefinition.

@Override
public Object visitLetRecAndDefinition(CatParser.LetRecAndDefinitionContext ctx) {
    RecursiveRelation rRecursive = (RecursiveRelation) relationRepository.getRelation(RecursiveRelation.class, ctx.n.getText());
    Relation rConcrete = ctx.e.accept(relationVisitor);
    if (rRecursive == null || rConcrete == null) {
        throw new ParsingException(ctx.getText());
    }
    rRecursive.setConcreteRelation(rConcrete);
    recursiveGroup.add(rRecursive);
    return null;
}
Also used : RecursiveRelation(com.dat3m.dartagnan.wmm.relation.RecursiveRelation) Relation(com.dat3m.dartagnan.wmm.relation.Relation) RecursiveRelation(com.dat3m.dartagnan.wmm.relation.RecursiveRelation) ParsingException(com.dat3m.dartagnan.exception.ParsingException)

Example 3 with Relation

use of com.dat3m.dartagnan.wmm.relation.Relation in project Dat3M by hernanponcedeleon.

the class VisitorBase method visitLetDefinition.

@Override
public Object visitLetDefinition(CatParser.LetDefinitionContext ctx) {
    Relation r = ctx.e.accept(relationVisitor);
    if (r != null) {
        r.setName(ctx.n.getText());
        relationRepository.updateRelation(r);
    } else {
        FilterAbstract f = ctx.e.accept(filterVisitor);
        f.setName(ctx.n.getText());
        wmm.addFilter(f);
    }
    return null;
}
Also used : RecursiveRelation(com.dat3m.dartagnan.wmm.relation.RecursiveRelation) Relation(com.dat3m.dartagnan.wmm.relation.Relation) FilterAbstract(com.dat3m.dartagnan.program.filter.FilterAbstract)

Example 4 with Relation

use of com.dat3m.dartagnan.wmm.relation.Relation in project Dat3M by hernanponcedeleon.

the class VisitorBase method visitLetRecDefinition.

@Override
public Object visitLetRecDefinition(CatParser.LetRecDefinitionContext ctx) {
    recursiveGroup = new HashSet<>();
    recursiveDef = true;
    RecursiveRelation rRecursive = (RecursiveRelation) relationRepository.getRelation(RecursiveRelation.class, ctx.n.getText());
    Relation rConcrete = ctx.e.accept(relationVisitor);
    if (rRecursive == null || rConcrete == null) {
        throw new ParsingException(ctx.getText());
    }
    rRecursive.setConcreteRelation(rConcrete);
    recursiveGroup.add(rRecursive);
    for (CatParser.LetRecAndDefinitionContext c : ctx.letRecAndDefinition()) {
        c.accept(this);
    }
    wmm.addRecursiveGroup(recursiveGroup);
    recursiveDef = false;
    return null;
}
Also used : RecursiveRelation(com.dat3m.dartagnan.wmm.relation.RecursiveRelation) Relation(com.dat3m.dartagnan.wmm.relation.Relation) RecursiveRelation(com.dat3m.dartagnan.wmm.relation.RecursiveRelation) ParsingException(com.dat3m.dartagnan.exception.ParsingException) CatParser(com.dat3m.dartagnan.parsers.CatParser)

Example 5 with Relation

use of com.dat3m.dartagnan.wmm.relation.Relation in project Dat3M by hernanponcedeleon.

the class VisitorRelation method visitBinaryRelation.

private Relation visitBinaryRelation(CatParser.ExpressionContext e1, CatParser.ExpressionContext e2, Class<?> c) {
    Relation r1 = e1.accept(this);
    Relation r2 = e2.accept(this);
    if (r1 != null && r2 != null) {
        return base.relationRepository.getRelation(c, r1, r2);
    }
    return null;
}
Also used : RecursiveRelation(com.dat3m.dartagnan.wmm.relation.RecursiveRelation) Relation(com.dat3m.dartagnan.wmm.relation.Relation)

Aggregations

Relation (com.dat3m.dartagnan.wmm.relation.Relation)15 RecursiveRelation (com.dat3m.dartagnan.wmm.relation.RecursiveRelation)9 ParsingException (com.dat3m.dartagnan.exception.ParsingException)3 FilterAbstract (com.dat3m.dartagnan.program.filter.FilterAbstract)3 RelationGraph (com.dat3m.dartagnan.solver.caat.predicates.relationGraphs.RelationGraph)2 Wmm (com.dat3m.dartagnan.wmm.Wmm)2 Axiom (com.dat3m.dartagnan.wmm.axiom.Axiom)2 RelComposition (com.dat3m.dartagnan.wmm.relation.binary.RelComposition)2 RelUnion (com.dat3m.dartagnan.wmm.relation.binary.RelUnion)2 RelationRepository (com.dat3m.dartagnan.wmm.utils.RelationRepository)2 CatParser (com.dat3m.dartagnan.parsers.CatParser)1 Event (com.dat3m.dartagnan.program.event.core.Event)1 MemEvent (com.dat3m.dartagnan.program.event.core.MemEvent)1 AcyclicityConstraint (com.dat3m.dartagnan.solver.caat.constraints.AcyclicityConstraint)1 Constraint (com.dat3m.dartagnan.solver.caat.constraints.Constraint)1 EmptinessConstraint (com.dat3m.dartagnan.solver.caat.constraints.EmptinessConstraint)1 IrreflexivityConstraint (com.dat3m.dartagnan.solver.caat.constraints.IrreflexivityConstraint)1 Edge (com.dat3m.dartagnan.solver.caat.predicates.relationGraphs.Edge)1 EmptyGraph (com.dat3m.dartagnan.solver.caat.predicates.relationGraphs.base.EmptyGraph)1 IdentityGraph (com.dat3m.dartagnan.solver.caat.predicates.relationGraphs.base.IdentityGraph)1