use of verdict.vdm.vdm_lustre.BinaryOperation in project VERDICT by ge-high-assurance.
the class VDM2Lustre method recordLiteral.
public void recordLiteral(Expression expr) {
if (expr != null) {
RecordLiteral recordLiteral = expr.getRecordLiteral();
if (recordLiteral != null) {
String identifier = recordLiteral.getRecordType();
identifier = identifier.replace(".", "_dot_");
identifier = identifier.replace("::", "_double_colon_");
recordLiteral.setRecordType(identifier);
for (FieldDefinition fieldDef : recordLiteral.getFieldDefinition()) {
expr = fieldDef.getFieldValue();
recordLiteral(expr);
}
} else {
BinaryOperation op = expr.getEqual();
if (op == null) {
op = expr.getNotEqual();
if (op == null) {
op = expr.getAnd();
if (op == null) {
op = expr.getImplies();
}
}
}
if (op != null) {
Expression lhs_expr = op.getLhsOperand();
recordLiteral(lhs_expr);
Expression rhs_expr = op.getRhsOperand();
recordLiteral(rhs_expr);
}
Expression not_expr = expr.getNot();
if (not_expr != null) {
recordLiteral(not_expr);
} else {
Expression pre_expr = expr.getPre();
recordLiteral(pre_expr);
}
NodeCall nodeCall = expr.getCall();
if (nodeCall != null) {
for (Expression arg : nodeCall.getArgument()) {
recordLiteral(arg);
}
}
}
}
}
use of verdict.vdm.vdm_lustre.BinaryOperation in project VERDICT by ge-high-assurance.
the class VDMInstrumentor method xor_expr.
protected Expression xor_expr(String i_id, String j_id) {
Expression amo_expr = new Expression();
Expression expr_i = new Expression();
expr_i.setIdentifier(i_id);
Expression expr_j = new Expression();
expr_j.setIdentifier(j_id);
Expression notexpr_i = new Expression();
notexpr_i.setNot(expr_i);
Expression notexpr_j = new Expression();
notexpr_j.setNot(expr_j);
BinaryOperation or_op = new BinaryOperation();
or_op.setLhsOperand(notexpr_i);
or_op.setRhsOperand(notexpr_j);
amo_expr.setOr(or_op);
return amo_expr;
}
use of verdict.vdm.vdm_lustre.BinaryOperation in project VERDICT by ge-high-assurance.
the class VDMInstrumentor method and_expr.
protected Expression and_expr(Stack<Expression> expr_stack) {
while (expr_stack.size() > 1) {
Expression left_expr = expr_stack.pop();
Expression right_expr = expr_stack.pop();
BinaryOperation and_op = new BinaryOperation();
and_op.setLhsOperand(left_expr);
and_op.setRhsOperand(right_expr);
Expression and_expr = new Expression();
and_expr.setAnd(and_op);
expr_stack.push(and_expr);
}
return expr_stack.pop();
}
Aggregations