예제 #1
0
 public override void Visit(MultiplyExpressionNode node)
 {
     node.expression1.Accept(this);
     Gen("push", "eax");
     node.expression2.Accept(this);
     Gen("pop", "edx");
     Gen("imul", "eax", "edx");
 }
예제 #2
0
        public override void Visit(MultiplyExpressionNode node)
        {
            node.expression1.Accept(this);
            node.expression2.Accept(this);

            if (!AreTypeCompatible(node.expression1.ExpressionType.GetType(), typeof(IntType)))
                throw new Exception("Expression 1 for * operation is not of type Int!");

            if (!AreTypeCompatible(node.expression2.ExpressionType.GetType(), typeof(IntType)))
                throw new Exception("Expression 2 for * operation is not of type Int!");

            node.ExpressionType = IntType.Instance;
        }
예제 #3
0
 public virtual void Visit(MultiplyExpressionNode node)
 {
     node.expression1.Accept(this);
     node.expression2.Accept(this);
 }
예제 #4
0
 public override void Visit(MultiplyExpressionNode node)
 {
     Console.WriteLine(this.indentation + "*");
     indentation = indentation + "   ";
     node.expression1.Accept(this);
     node.expression2.Accept(this);
     indentation = indentation.Substring(0, indentation.Length - 3);
 }