public override void Visit(AdditionExpression6 ae) { _sb.Append("("); ae.LHS.Accept(this); _sb.Append("+"); ae.RHS.Accept(this); _sb.Append(")"); }
// change to Main to run. public static void Main(string[] args) { var simpleAddition = new AdditionExpression6(new Value(2), new Value(3)); var ep = new ExpressionPrinter5(); ep.Visit(simpleAddition); Console.WriteLine(ep.ToString()); var simpleMultiplication = new MultiplicationExpression(new Value(7), new Value(7)); var ep2 = new ExpressionPrinter5(); ep2.Visit(simpleMultiplication); Console.WriteLine(ep2.ToString()); }
public abstract void Visit(AdditionExpression6 ae);