Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            var printer    = new ExpressionPrinter();
            var expression = new MultiplicationExpression(
                new Value(5),
                new AdditionExpression(
                    new Value(2),
                    new Value(3)));

            printer.Visit(expression);

            Console.WriteLine(printer.ToString()); //5*(2+3)
        }
 public override void Visit(MultiplicationExpression multiplicationExpresion)
 {
     multiplicationExpresion.LHS.Accept(this);
     _sb.Append("*");
     multiplicationExpresion.RHS.Accept(this);
 }