Beispiel #1
0
        // #ADD_EXPRESSION #EXPRESSION PLUS #TERM
        private void ConstructAddExpr()
        {
            var right = nodes.Pop() as AstExpression;
            var left = nodes.Pop() as AstExpression;

            var expr = new AstAddExpression(left, right);
            PushNode(expr);
        }
 public override bool Visit(AstAddExpression node)
 {
     ErrorIfIsNull(node.Left);
     ErrorIfIsNull(node.Right);
     return true;
 }
 public override bool Visit(AstAddExpression node)
 {
     return true;
 }
 public override bool Visit(AstAddExpression node)
 {
     node.Left.Accept(this);
     string addLine = " = add i32 " + GetCurrUnnamedVariable() + ", ";
     node.Right.Accept(this);
     addLine += GetCurrUnnamedVariable();
     codeStream.WriteLine(CreateUnnamedVariable() + addLine);
     SaveArg("i32 " + GetCurrUnnamedVariable());
     return false;
 }
 public override bool Visit(AstAddExpression node)
 {
     var leftType = resolver.Resolve(node.Left);
     var rightType = resolver.Resolve(node.Right);
     if (leftType != BuiltInTypes.INT || rightType != BuiltInTypes.INT)
     {
         DispatchError(node.TextPosition, "Add operation available only for integer types.");
         return false;
     }
     return true;
 }
 public abstract bool Visit(AstAddExpression node);