コード例 #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);
        }
コード例 #2
0
 public override bool Visit(AstAddExpression node)
 {
     ErrorIfIsNull(node.Left);
     ErrorIfIsNull(node.Right);
     return true;
 }
コード例 #3
0
 public override bool Visit(AstAddExpression node)
 {
     return true;
 }
コード例 #4
0
 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;
 }
コード例 #5
0
 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;
 }
コード例 #6
0
 public abstract bool Visit(AstAddExpression node);