public double Visit(PlusOpNode caller) { double left = caller.LeftSon.Accept(this); double right = caller.RightSon.Accept(this); return(left + right); }
public int Visit(PlusOpNode caller) { int left = caller.LeftSon.Accept(this); int right = caller.RightSon.Accept(this); return(checked (left + right)); }
public string Visit(PlusOpNode visited) { var sb = new StringBuilder(); // + has lowest priority and is associative - no need for parentheses around either child sb.Append(visited.LeftSon.Accept(this)); sb.Append("+"); sb.Append(visited.RightSon.Accept(this)); return(sb.ToString()); }
public string Visit(PlusOpNode visited) { var sb = new StringBuilder(); sb.Append("("); sb.Append(visited.LeftSon.Accept(this)); sb.Append("+"); sb.Append(visited.RightSon.Accept(this)); sb.Append(")"); return(sb.ToString()); }
public int Visit(PlusOpNode visited) { return(0); }