protected BinaryOperator(Rollable left, Rollable right) { if (left == null) { throw new ArgumentNullException(nameof(left)); } if (right == null) { throw new ArgumentNullException(nameof(right)); } this.Left = left; this.Right = right; }
private bool needsParenthesis(Rollable child) => (child as BinaryOperator)?.OperatorPrecedence < this.OperatorPrecedence;
public abstract Rollable With(Rollable left, Rollable right);
public Rollable Times(Rollable right) => this * right;
public Rollable Minus(Rollable right) => this - right;
public Rollable Plus(Rollable right) => this + right;