Skip to content

Commit

Permalink
More constructors for logic and numeric exprs.
Browse files Browse the repository at this point in the history
  • Loading branch information
giacomo-boldini committed Feb 7, 2024
1 parent 1617cc4 commit f6d4253
Show file tree
Hide file tree
Showing 10 changed files with 451 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import it.unive.lisa.program.cfg.CodeLocation;
import it.unive.lisa.program.cfg.statement.Expression;
import it.unive.lisa.program.cfg.statement.Statement;
import it.unive.lisa.program.cfg.statement.evaluation.EvaluationOrder;
import it.unive.lisa.symbolic.SymbolicExpression;
import it.unive.lisa.symbolic.value.BinaryExpression;
import it.unive.lisa.symbolic.value.operator.binary.LogicalAnd;
Expand Down Expand Up @@ -40,6 +41,25 @@ public And(
super(cfg, location, "&&", cfg.getDescriptor().getUnit().getProgram().getTypes().getBooleanType(), left, right);
}

/**
* Builds the logical conjunction.
*
* @param cfg the {@link CFG} where this operation lies
* @param location the location where this literal is defined
* @param order the evaluation order of the sub-expressions
* @param left the left-hand side of this operation
* @param right the right-hand side of this operation
*/
public And(
CFG cfg,
CodeLocation location,
EvaluationOrder order,
Expression left,
Expression right) {
super(cfg, location, "&&", order, cfg.getDescriptor().getUnit().getProgram().getTypes().getBooleanType(), left,
right);
}

@Override
protected int compareSameClassAndParams(
Statement o) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import it.unive.lisa.program.cfg.CodeLocation;
import it.unive.lisa.program.cfg.statement.Expression;
import it.unive.lisa.program.cfg.statement.Statement;
import it.unive.lisa.program.cfg.statement.evaluation.EvaluationOrder;
import it.unive.lisa.symbolic.SymbolicExpression;
import it.unive.lisa.symbolic.value.UnaryExpression;
import it.unive.lisa.symbolic.value.operator.unary.LogicalNegation;
Expand Down Expand Up @@ -38,6 +39,23 @@ public Not(
super(cfg, location, "!", cfg.getDescriptor().getUnit().getProgram().getTypes().getBooleanType(), expression);
}

/**
* Builds the logical negation.
*
* @param cfg the {@link CFG} where this operation lies
* @param location the location where this literal is defined
* @param order the evaluation order of the sub-expressions
* @param expression the operand of this operation
*/
public Not(
CFG cfg,
CodeLocation location,
EvaluationOrder order,
Expression expression) {
super(cfg, location, "!", order, cfg.getDescriptor().getUnit().getProgram().getTypes().getBooleanType(),
expression);
}

@Override
protected int compareSameClassAndParams(
Statement o) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import it.unive.lisa.program.cfg.CodeLocation;
import it.unive.lisa.program.cfg.statement.Expression;
import it.unive.lisa.program.cfg.statement.Statement;
import it.unive.lisa.program.cfg.statement.evaluation.EvaluationOrder;
import it.unive.lisa.symbolic.SymbolicExpression;
import it.unive.lisa.symbolic.value.BinaryExpression;
import it.unive.lisa.symbolic.value.operator.binary.LogicalOr;
Expand Down Expand Up @@ -40,6 +41,25 @@ public Or(
super(cfg, location, "||", cfg.getDescriptor().getUnit().getProgram().getTypes().getBooleanType(), left, right);
}

/**
* Builds the logical disjunction.
*
* @param cfg the {@link CFG} where this operation lies
* @param location the location where this literal is defined
* @param order the evaluation order of the sub-expressions
* @param left the left-hand side of this operation
* @param right the right-hand side of this operation
*/
public Or(
CFG cfg,
CodeLocation location,
EvaluationOrder order,
Expression left,
Expression right) {
super(cfg, location, "||", order, cfg.getDescriptor().getUnit().getProgram().getTypes().getBooleanType(), left,
right);
}

@Override
protected int compareSameClassAndParams(
Statement o) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import it.unive.lisa.program.cfg.CodeLocation;
import it.unive.lisa.program.cfg.statement.Expression;
import it.unive.lisa.program.cfg.statement.Statement;
import it.unive.lisa.program.cfg.statement.evaluation.EvaluationOrder;
import it.unive.lisa.symbolic.SymbolicExpression;
import it.unive.lisa.symbolic.value.BinaryExpression;
import it.unive.lisa.symbolic.value.operator.binary.NumericNonOverflowingAdd;
Expand Down Expand Up @@ -41,6 +42,62 @@ public Addition(
super(cfg, location, "+", left, right);
}

/**
* Builds the addition.
*
* @param cfg the {@link CFG} where this operation lies
* @param location the location where this literal is defined
* @param staticType the static type of this operation
* @param left the left-hand side of this operation
* @param right the right-hand side of this operation
*/
public Addition(
CFG cfg,
CodeLocation location,
Type staticType,
Expression left,
Expression right) {
super(cfg, location, "+", staticType, left, right);
}

/**
* Builds the addition.
*
* @param cfg the {@link CFG} where this operation lies
* @param location the location where this literal is defined
* @param order the evaluation order of the sub-expressions
* @param left the left-hand side of this operation
* @param right the right-hand side of this operation
*/
public Addition(
CFG cfg,
CodeLocation location,
EvaluationOrder order,
Expression left,
Expression right) {
super(cfg, location, "+", order, left, right);
}

/**
* Builds the addition.
*
* @param cfg the {@link CFG} where this operation lies
* @param location the location where this literal is defined
* @param order the evaluation order of the sub-expressions
* @param staticType the static type of this operation
* @param left the left-hand side of this operation
* @param right the right-hand side of this operation
*/
public Addition(
CFG cfg,
CodeLocation location,
EvaluationOrder order,
Type staticType,
Expression left,
Expression right) {
super(cfg, location, "+", order, staticType, left, right);
}

@Override
protected int compareSameClassAndParams(
Statement o) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import it.unive.lisa.program.cfg.CodeLocation;
import it.unive.lisa.program.cfg.statement.Expression;
import it.unive.lisa.program.cfg.statement.Statement;
import it.unive.lisa.program.cfg.statement.evaluation.EvaluationOrder;
import it.unive.lisa.symbolic.SymbolicExpression;
import it.unive.lisa.symbolic.value.BinaryExpression;
import it.unive.lisa.symbolic.value.operator.binary.NumericNonOverflowingDiv;
Expand Down Expand Up @@ -41,6 +42,62 @@ public Division(
super(cfg, location, "/", left, right);
}

/**
* Builds the division.
*
* @param cfg the {@link CFG} where this operation lies
* @param location the location where this literal is defined
* @param staticType the static type of this operation
* @param left the left-hand side of this operation
* @param right the right-hand side of this operation
*/
public Division(
CFG cfg,
CodeLocation location,
Type staticType,
Expression left,
Expression right) {
super(cfg, location, "/", staticType, left, right);
}

/**
* Builds the division.
*
* @param cfg the {@link CFG} where this operation lies
* @param location the location where this literal is defined
* @param order the evaluation order of the sub-expressions
* @param left the left-hand side of this operation
* @param right the right-hand side of this operation
*/
public Division(
CFG cfg,
CodeLocation location,
EvaluationOrder order,
Expression left,
Expression right) {
super(cfg, location, "/", order, left, right);
}

/**
* Builds the division.
*
* @param cfg the {@link CFG} where this operation lies
* @param location the location where this literal is defined
* @param order the evaluation order of the sub-expressions
* @param staticType the static type of this operation
* @param left the left-hand side of this operation
* @param right the right-hand side of this operation
*/
public Division(
CFG cfg,
CodeLocation location,
EvaluationOrder order,
Type staticType,
Expression left,
Expression right) {
super(cfg, location, "/", order, staticType, left, right);
}

@Override
protected int compareSameClassAndParams(
Statement o) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import it.unive.lisa.program.cfg.CodeLocation;
import it.unive.lisa.program.cfg.statement.Expression;
import it.unive.lisa.program.cfg.statement.Statement;
import it.unive.lisa.program.cfg.statement.evaluation.EvaluationOrder;
import it.unive.lisa.symbolic.SymbolicExpression;
import it.unive.lisa.symbolic.value.BinaryExpression;
import it.unive.lisa.symbolic.value.operator.binary.NumericNonOverflowingMod;
Expand Down Expand Up @@ -42,6 +43,62 @@ public Modulo(
super(cfg, location, "%", left, right);
}

/**
* Builds the modulo.
*
* @param cfg the {@link CFG} where this operation lies
* @param location the location where this literal is defined
* @param staticType the static type of this operation
* @param left the left-hand side of this operation
* @param right the right-hand side of this operation
*/
public Modulo(
CFG cfg,
CodeLocation location,
Type staticType,
Expression left,
Expression right) {
super(cfg, location, "%", staticType, left, right);
}

/**
* Builds the modulo.
*
* @param cfg the {@link CFG} where this operation lies
* @param location the location where this literal is defined
* @param order the evaluation order of the sub-expressions
* @param left the left-hand side of this operation
* @param right the right-hand side of this operation
*/
public Modulo(
CFG cfg,
CodeLocation location,
EvaluationOrder order,
Expression left,
Expression right) {
super(cfg, location, "%", order, left, right);
}

/**
* Builds the modulo.
*
* @param cfg the {@link CFG} where this operation lies
* @param location the location where this literal is defined
* @param order the evaluation order of the sub-expressions
* @param staticType the static type of this operation
* @param left the left-hand side of this operation
* @param right the right-hand side of this operation
*/
public Modulo(
CFG cfg,
CodeLocation location,
EvaluationOrder order,
Type staticType,
Expression left,
Expression right) {
super(cfg, location, "%", order, staticType, left, right);
}

@Override
protected int compareSameClassAndParams(
Statement o) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import it.unive.lisa.program.cfg.CodeLocation;
import it.unive.lisa.program.cfg.statement.Expression;
import it.unive.lisa.program.cfg.statement.Statement;
import it.unive.lisa.program.cfg.statement.evaluation.EvaluationOrder;
import it.unive.lisa.symbolic.SymbolicExpression;
import it.unive.lisa.symbolic.value.BinaryExpression;
import it.unive.lisa.symbolic.value.operator.binary.NumericNonOverflowingMul;
Expand Down Expand Up @@ -41,6 +42,62 @@ public Multiplication(
super(cfg, location, "*", left, right);
}

/**
* Builds the multiplication.
*
* @param cfg the {@link CFG} where this operation lies
* @param location the location where this literal is defined
* @param staticType the static type of this operation
* @param left the left-hand side of this operation
* @param right the right-hand side of this operation
*/
public Multiplication(
CFG cfg,
CodeLocation location,
Type staticType,
Expression left,
Expression right) {
super(cfg, location, "*", staticType, left, right);
}

/**
* Builds the multiplication.
*
* @param cfg the {@link CFG} where this operation lies
* @param location the location where this literal is defined
* @param order the evaluation order of the sub-expressions
* @param left the left-hand side of this operation
* @param right the right-hand side of this operation
*/
public Multiplication(
CFG cfg,
CodeLocation location,
EvaluationOrder order,
Expression left,
Expression right) {
super(cfg, location, "*", order, left, right);
}

/**
* Builds the multiplication.
*
* @param cfg the {@link CFG} where this operation lies
* @param location the location where this literal is defined
* @param order the evaluation order of the sub-expressions
* @param staticType the static type of this operation
* @param left the left-hand side of this operation
* @param right the right-hand side of this operation
*/
public Multiplication(
CFG cfg,
CodeLocation location,
EvaluationOrder order,
Type staticType,
Expression left,
Expression right) {
super(cfg, location, "*", order, staticType, left, right);
}

@Override
protected int compareSameClassAndParams(
Statement o) {
Expand Down
Loading

0 comments on commit f6d4253

Please sign in to comment.