Skip to content

Commit f367c61

Browse files
xerenhernanponcedeleon
authored andcommitted
Rename cat built-in 'New()' to 'newSet()'.
Rename 'new()' to 'newRelation()'.
1 parent 053678d commit f367c61

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

dartagnan/src/main/antlr4/Cat.g4

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ expression
5353
| (TOID LPAR e = expression RPAR | LBRAC e = expression RBRAC) # exprIdentity
5454
| LPAR e = expression RPAR # expr
5555
| n = NAME # exprBasic
56-
| call = NEW LPAR RPAR # exprNew
56+
| NEW_SET LPAR RPAR # exprNewSet
57+
| NEW_RELATION LPAR RPAR # exprNewRelation
5758
| call = NAME LPAR args = argumentList RPAR # exprCall
5859
;
5960

@@ -103,9 +104,10 @@ LBRAC : '[';
103104
RBRAC : ']';
104105
COMMA : ',';
105106

106-
DOMAIN : 'domain';
107-
RANGE : 'range';
108-
NEW : '[n|N]ew';
107+
DOMAIN : 'domain';
108+
RANGE : 'range';
109+
NEW_SET : 'newSet';
110+
NEW_RELATION : 'newRelation';
109111

110112
FLAG : 'flag';
111113
UNDEFINED : 'undefined_unless';

dartagnan/src/main/java/com/dat3m/dartagnan/parsers/cat/VisitorCat.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -203,9 +203,13 @@ public Object visitExpr(ExprContext ctx) {
203203
}
204204

205205
@Override
206-
public Object visitExprNew(ExprNewContext ctx) {
207-
final boolean unary = ctx.call.getText().equals("New");
208-
return addDefinition(new Free(wmm.newRelation(unary ? Relation.Arity.UNARY : Relation.Arity.BINARY)));
206+
public Object visitExprNewSet(ExprNewSetContext ctx) {
207+
return addDefinition(new Free(wmm.newRelation(Relation.Arity.UNARY)));
208+
}
209+
210+
@Override
211+
public Object visitExprNewRelation(ExprNewRelationContext ctx) {
212+
return addDefinition(new Free(wmm.newRelation(Relation.Arity.BINARY)));
209213
}
210214

211215
@Override

0 commit comments

Comments
 (0)