Example #1
0
 public override void Visit(AddExpressionNode node)
 {
     Console.WriteLine(this.indentation + "+");
     indentation = indentation + "   ";
     node.expression1.Accept(this);
     node.expression2.Accept(this);
     indentation = indentation.Substring(0, indentation.Length - 3);
 }
 public override void Visit(AddExpressionNode node)
 {
     node.expression1.Accept(this);
     Gen("push", "eax");
     node.expression2.Accept(this);
     Gen("pop", "edx");
     Gen("add", "eax", "edx");
 }
Example #3
0
 public virtual void Visit(AddExpressionNode node)
 {
     node.expression1.Accept(this);
     node.expression2.Accept(this);
 }
Example #4
0
        public override void Visit(AddExpressionNode 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;
        }