Example #1
0
 public void Visit(AdditionExpression obj)
 {
     sb.Append("(");
     obj.Left.Accept(this);
     sb.Append("+");
     obj.Right.Accept(this);
     sb.Append(")");
 }
Example #2
0
        static void Main(string[] args)
        {
            var e = new AdditionExpression(
                left: new DoubleExpression(3),
                right: new AdditionExpression(
                    left: new DoubleExpression(4),
                    right: new DoubleExpression(7)));
            var ep = new ExpressionPrinter();

            ep.Visit(e);
            WriteLine(ep);

            ReadKey();
        }