コード例 #1
0
 public override AstNode Visit(BinaryOperation node)
 {
     // Visit recursively.
     node.GetLeftExpression().Accept(this);
     node.GetRightExpression().Accept(this);
     return node;
 }
コード例 #2
0
ファイル: AstVisitor.cs プロジェクト: ronsaldo/chela
 public virtual AstNode Visit(BinaryOperation node)
 {
     throw new System.NotImplementedException();
 }
コード例 #3
0
ファイル: ConstantExpansion.cs プロジェクト: ronsaldo/chela
        public override AstNode Visit(BinaryOperation node)
        {
            // Process the left expression.
            Expression left = node.GetLeftExpression();
            left = (Expression)left.Accept(this);
            node.SetLeftExpression(left);

            // Process the right expression.
            Expression right = node.GetRightExpression();
            right = (Expression)right.Accept(this);
            node.SetRightExpression(node);

            // Get the node type.
            IChelaType nodeType = node.GetNodeType();
            if(!nodeType.IsConstant())
                return node;

            // Perform left constant coercion.
            ConstantValue leftConstant = (ConstantValue)left.GetNodeValue();
            IChelaType leftType = left.GetNodeType();
            IChelaType leftCoercion = node.GetCoercionType();
            if(leftType != leftCoercion)
                leftConstant = leftConstant.Cast(leftCoercion);

            // Perform right constant coercion.
            ConstantValue rightConstant = (ConstantValue)right.GetNodeValue();
            IChelaType rightType = right.GetNodeType();
            IChelaType rightCoercion = node.GetSecondCoercion();
            if(rightType != rightCoercion)
                rightConstant = rightConstant.Cast(rightCoercion);

            // Perform the constant operation.
            ConstantValue res = null;
            switch(node.GetOperation())
            {
            case BinaryOperation.OpAdd:
                res = leftConstant + rightConstant;
                break;
            case BinaryOperation.OpSub:
                res = leftConstant - rightConstant;
                break;
            case BinaryOperation.OpMul:
                res = leftConstant * rightConstant;
                break;
            case BinaryOperation.OpDiv:
                res = leftConstant / rightConstant;
                break;
            case BinaryOperation.OpMod:
                res = leftConstant % rightConstant;
                break;
            case BinaryOperation.OpEQ:
                res = ConstantValue.Equals(leftConstant, rightConstant);
                break;
            case BinaryOperation.OpNEQ:
                res = ConstantValue.NotEquals(leftConstant, rightConstant);
                break;
            case BinaryOperation.OpLT:
                res = leftConstant < rightConstant;
                break;
            case BinaryOperation.OpLEQ:
                res = leftConstant <= rightConstant;
                break;
            case BinaryOperation.OpGT:
                res = leftConstant > rightConstant;
                break;
            case BinaryOperation.OpGEQ:
                res = leftConstant >= rightConstant;
                break;
            case BinaryOperation.OpBitAnd:
                res = leftConstant & rightConstant;
                break;
            case BinaryOperation.OpBitOr:
                res = leftConstant | rightConstant;
                break;
            case BinaryOperation.OpBitXor:
                res = leftConstant ^ rightConstant;
                break;
            case BinaryOperation.OpBitLeft:
                res = ConstantValue.BitLeft(leftConstant, rightConstant);
                break;
            case BinaryOperation.OpBitRight:
                res = ConstantValue.BitRight(leftConstant, rightConstant);
                break;
            case BinaryOperation.OpLAnd:
                res = new ConstantValue(leftConstant.GetBoolValue() && rightConstant.GetBoolValue());
                break;
            case BinaryOperation.OpLOr:
                res = new ConstantValue(leftConstant.GetBoolValue() || rightConstant.GetBoolValue());
                break;
            default:
                throw new System.NotImplementedException();
            }

            // Return the result node.
            return res.ToAstNode(node.GetPosition());
        }
コード例 #4
0
ファイル: FunctionGenerator.cs プロジェクト: ronsaldo/chela
        public override AstNode Visit(BinaryOperation node)
        {
            // Begin the node.
            builder.BeginNode(node);

            // Get the expressions.
            Expression left = node.GetLeftExpression();
            Expression right = node.GetRightExpression();

            // Get the types.
            IChelaType leftType = left.GetNodeType();
            IChelaType rightType = right.GetNodeType();
            IChelaType coercionType = node.GetCoercionType();
            IChelaType secondCoercion = node.GetSecondCoercion();
            IChelaType operationType = node.GetOperationType();
            IChelaType destType = node.GetNodeType();

            // Special pipeline for operator overloading.
            Function overload = node.GetOverload();
            if(overload != null)
            {
                FunctionType overloadType = overload.GetFunctionType();
                coercionType = overloadType.GetArgument(0);
                secondCoercion = overloadType.GetArgument(1);

                // Send first the left operand.
                left.Accept(this);
                if(leftType != coercionType)
                    Cast(node, left.GetNodeValue(), leftType, coercionType);

                // Now send the right operand.
                right.Accept(this);
                if(rightType != secondCoercion)
                    Cast(node, right.GetNodeValue(), rightType, secondCoercion);

                // Perform the call.
                builder.CreateCall(overload, 2);

                // Return the node.
                return builder.EndNode();
            }

            // Send the left operand.
            left.Accept(this);
            if(leftType != coercionType)
                Cast(node, left.GetNodeValue(), leftType, coercionType);

            // Short circuit operations has special evaluation orders.
            if(node.GetOperation() == BinaryOperation.OpLAnd ||
               node.GetOperation() == BinaryOperation.OpLOr)
            {
                BasicBlock continueBlock = CreateBasicBlock();
                continueBlock.SetName("shc");

                BasicBlock stopBlock = CreateBasicBlock();
                stopBlock.SetName("shs");

                BasicBlock mergeBlock = CreateBasicBlock();
                mergeBlock.SetName("shm");

                // Perform left branch.
                if(node.GetOperation() == BinaryOperation.OpLAnd)
                    builder.CreateBr(continueBlock, stopBlock);
                else
                    builder.CreateBr(stopBlock, continueBlock);

                // Build stop.
                builder.SetBlock(stopBlock);
                builder.CreateLoadBool(node.GetOperation() == BinaryOperation.OpLOr);
                builder.CreateJmp(mergeBlock);

                // Build continue block.
                builder.SetBlock(continueBlock);

                // Send the right operand verbatim.
                right.Accept(this);
                if(rightType != secondCoercion)
                    Cast(node, right.GetNodeValue(), rightType, secondCoercion);
                builder.CreateJmp(mergeBlock);

                // Continue with the control flow.
                builder.SetBlock(mergeBlock);
                return builder.EndNode();
            }

            // Send the right operand.
            right.Accept(this);
            if(rightType != secondCoercion)
                Cast(node, right.GetNodeValue(), rightType, secondCoercion);

            switch(node.GetOperation())
            {
            case BinaryOperation.OpAdd:
                builder.CreateAdd();
                break;
            case BinaryOperation.OpSub:
                builder.CreateSub();
                break;
            case BinaryOperation.OpMul:
                if(node.IsMatrixMul())
                    builder.CreateMatMul();
                else
                    builder.CreateMul();
                break;
            case BinaryOperation.OpDiv:
                builder.CreateDiv();
                break;
            case BinaryOperation.OpMod:
                builder.CreateMod();
                break;
            case BinaryOperation.OpBitAnd:
                builder.CreateAnd();
                break;
            case BinaryOperation.OpBitOr:
                builder.CreateOr();
                break;
            case BinaryOperation.OpBitXor:
                builder.CreateXor();
                break;
            case BinaryOperation.OpBitLeft:
                builder.CreateShLeft();
                break;
            case BinaryOperation.OpBitRight:
                builder.CreateShRight();
                break;
            case BinaryOperation.OpLT:
                builder.CreateCmpLT();
                break;
            case BinaryOperation.OpGT:
                builder.CreateCmpGT();
                break;
            case BinaryOperation.OpEQ:
                builder.CreateCmpEQ();
                break;
            case BinaryOperation.OpNEQ:
                builder.CreateCmpNE();
                break;
            case BinaryOperation.OpLEQ:
                builder.CreateCmpLE();
                break;
            case BinaryOperation.OpGEQ:
                builder.CreateCmpGE();
                break;
            case BinaryOperation.OpLAnd:
            case BinaryOperation.OpLOr:
                // Shouldn't reach here.
                break;
            }

            // Cast the result.
            if(operationType != destType)
                Cast(node, null, operationType, destType);

            return builder.EndNode();
        }
コード例 #5
0
 public virtual AstNode Visit(BinaryOperation node)
 {
     throw new System.NotImplementedException();
 }
コード例 #6
0
ファイル: Parser.cs プロジェクト: ronsaldo/chela
  /** the generated parser.
      Maintains a state and a value stack, currently with fixed maximum size.
      @param yyLex scanner.
      @return result of the last reduction, if any.
      @throws yyException on irrecoverable parse error.
    */
  internal Object yyparse (yyParser.yyInput yyLex)
  {
    if (yyMax <= 0) yyMax = 256;		// initial size
    int yyState = 0;                   // state stack ptr
    int [] yyStates;               	// state stack 
    yyVal = null;
    yyToken = -1;
    int yyErrorFlag = 0;				// #tks to shift
	if (use_global_stacks && global_yyStates != null) {
		yyVals = global_yyVals;
		yyStates = global_yyStates;
   } else {
		yyVals = new object [yyMax];
		yyStates = new int [yyMax];
		if (use_global_stacks) {
			global_yyVals = yyVals;
			global_yyStates = yyStates;
		}
	}

    /*yyLoop:*/ for (yyTop = 0;; ++ yyTop) {
      if (yyTop >= yyStates.Length) {			// dynamically increase
        global::System.Array.Resize (ref yyStates, yyStates.Length+yyMax);
        global::System.Array.Resize (ref yyVals, yyVals.Length+yyMax);
      }
      yyStates[yyTop] = yyState;
      yyVals[yyTop] = yyVal;
//t      if (debug != null) debug.push(yyState, yyVal);

      /*yyDiscarded:*/ while (true) {	// discarding a token does not change stack
        int yyN;
        if ((yyN = yyDefRed[yyState]) == 0) {	// else [default] reduce (yyN)
          if (yyToken < 0) {
            yyToken = yyLex.advance() ? yyLex.token() : 0;
//t            if (debug != null)
//t              debug.lex(yyState, yyToken, yyname(yyToken), yyLex.value());
          }
          if ((yyN = yySindex[yyState]) != 0 && ((yyN += yyToken) >= 0)
              && (yyN < yyTable.Length) && (yyCheck[yyN] == yyToken)) {
//t            if (debug != null)
//t              debug.shift(yyState, yyTable[yyN], yyErrorFlag-1);
            yyState = yyTable[yyN];		// shift to yyN
            yyVal = yyLex.value();
            yyToken = -1;
            if (yyErrorFlag > 0) -- yyErrorFlag;
            goto continue_yyLoop;
          }
          if ((yyN = yyRindex[yyState]) != 0 && (yyN += yyToken) >= 0
              && yyN < yyTable.Length && yyCheck[yyN] == yyToken)
            yyN = yyTable[yyN];			// reduce (yyN)
          else
            switch (yyErrorFlag) {
  
            case 0:
              yyExpectingState = yyState;
              // yyerror(String.Format ("syntax error, got token `{0}'", yyname (yyToken)), yyExpecting(yyState));
//t              if (debug != null) debug.error("syntax error");
              if (yyToken == 0 /*eof*/ || yyToken == eof_token) throw new yyParser.yyUnexpectedEof ();
              goto case 1;
            case 1: case 2:
              yyErrorFlag = 3;
              do {
                if ((yyN = yySindex[yyStates[yyTop]]) != 0
                    && (yyN += Token.yyErrorCode) >= 0 && yyN < yyTable.Length
                    && yyCheck[yyN] == Token.yyErrorCode) {
//t                  if (debug != null)
//t                    debug.shift(yyStates[yyTop], yyTable[yyN], 3);
                  yyState = yyTable[yyN];
                  yyVal = yyLex.value();
                  goto continue_yyLoop;
                }
//t                if (debug != null) debug.pop(yyStates[yyTop]);
              } while (-- yyTop >= 0);
//t              if (debug != null) debug.reject();
              throw new yyParser.yyException("irrecoverable syntax error");
  
            case 3:
              if (yyToken == 0) {
//t                if (debug != null) debug.reject();
                throw new yyParser.yyException("irrecoverable syntax error at end-of-file");
              }
//t              if (debug != null)
//t                debug.discard(yyState, yyToken, yyname(yyToken),
//t  							yyLex.value());
              yyToken = -1;
              goto continue_yyDiscarded;		// leave stack alone
            }
        }
        int yyV = yyTop + 1-yyLen[yyN];
//t        if (debug != null)
//t          debug.reduce(yyState, yyStates[yyV-1], yyN, YYRules.getRule (yyN), yyLen[yyN]);
        yyVal = yyV > yyTop ? null : yyVals[yyV]; // yyVal = yyDefault(yyV > yyTop ? null : yyVals[yyV]);
        switch (yyN) {
case 1:
#line 548 "Parser.y"
  { yyVal = new TypeNode(TypeKind.Bool, ((TokenPosition)yyVals[0+yyTop])); }
  break;
case 2:
#line 549 "Parser.y"
  { yyVal = new TypeNode(TypeKind.Byte, ((TokenPosition)yyVals[0+yyTop])); }
  break;
case 3:
#line 550 "Parser.y"
  { yyVal = new TypeNode(TypeKind.SByte, ((TokenPosition)yyVals[0+yyTop])); }
  break;
case 4:
#line 551 "Parser.y"
  { yyVal = new TypeNode(TypeKind.Char, ((TokenPosition)yyVals[0+yyTop])); }
  break;
case 5:
#line 552 "Parser.y"
  { yyVal = new TypeNode(TypeKind.UChar, ((TokenPosition)yyVals[0+yyTop])); }
  break;
case 6:
#line 553 "Parser.y"
  { yyVal = new TypeNode(TypeKind.Double, ((TokenPosition)yyVals[0+yyTop])); }
  break;
case 7:
#line 554 "Parser.y"
  { yyVal = new TypeNode(TypeKind.Float, ((TokenPosition)yyVals[0+yyTop])); }
  break;
case 8:
#line 555 "Parser.y"
  { yyVal = new TypeNode(TypeKind.Int, ((TokenPosition)yyVals[0+yyTop])); }
  break;
case 9:
#line 556 "Parser.y"
  { yyVal = new TypeNode(TypeKind.UInt, ((TokenPosition)yyVals[0+yyTop])); }
  break;
case 10:
#line 557 "Parser.y"
  { yyVal = new TypeNode(TypeKind.Long, ((TokenPosition)yyVals[0+yyTop])); }
  break;
case 11:
#line 558 "Parser.y"
  { yyVal = new TypeNode(TypeKind.ULong, ((TokenPosition)yyVals[0+yyTop])); }
  break;
case 12:
#line 559 "Parser.y"
  { yyVal = new TypeNode(TypeKind.Short, ((TokenPosition)yyVals[0+yyTop])); }
  break;
case 13:
#line 560 "Parser.y"
  { yyVal = new TypeNode(TypeKind.UShort, ((TokenPosition)yyVals[0+yyTop])); }
  break;
case 14:
#line 561 "Parser.y"
  { yyVal = new TypeNode(TypeKind.Object, ((TokenPosition)yyVals[0+yyTop])); }
  break;
case 15:
#line 562 "Parser.y"
  { yyVal = new TypeNode(TypeKind.String, ((TokenPosition)yyVals[0+yyTop])); }
  break;
case 16:
#line 563 "Parser.y"
  { yyVal = new TypeNode(TypeKind.Size, ((TokenPosition)yyVals[0+yyTop])); }
  break;
case 17:
#line 564 "Parser.y"
  { yyVal = new TypeNode(TypeKind.Void, ((TokenPosition)yyVals[0+yyTop])); }
  break;
case 18:
#line 565 "Parser.y"
  { yyVal = new TypeNode(TypeKind.PtrDiff, ((TokenPosition)yyVals[0+yyTop])); }
  break;
case 19:
#line 567 "Parser.y"
  { yyVal = new TypeNode(TypeKind.Float, 2, ((TokenPosition)yyVals[0+yyTop])); }
  break;
case 20:
#line 568 "Parser.y"
  { yyVal = new TypeNode(TypeKind.Float, 3, ((TokenPosition)yyVals[0+yyTop])); }
  break;
case 21:
#line 569 "Parser.y"
  { yyVal = new TypeNode(TypeKind.Float, 4, ((TokenPosition)yyVals[0+yyTop])); }
  break;
case 22:
#line 570 "Parser.y"
  { yyVal = new TypeNode(TypeKind.Double, 2, ((TokenPosition)yyVals[0+yyTop])); }
  break;
case 23:
#line 571 "Parser.y"
  { yyVal = new TypeNode(TypeKind.Double, 3, ((TokenPosition)yyVals[0+yyTop])); }
  break;
case 24:
#line 572 "Parser.y"
  { yyVal = new TypeNode(TypeKind.Double, 4, ((TokenPosition)yyVals[0+yyTop])); }
  break;
case 25:
#line 573 "Parser.y"
  { yyVal = new TypeNode(TypeKind.Int, 2, ((TokenPosition)yyVals[0+yyTop])); }
  break;
case 26:
#line 574 "Parser.y"
  { yyVal = new TypeNode(TypeKind.Int, 3, ((TokenPosition)yyVals[0+yyTop])); }
  break;
case 27:
#line 575 "Parser.y"
  { yyVal = new TypeNode(TypeKind.Int, 4, ((TokenPosition)yyVals[0+yyTop])); }
  break;
case 28:
#line 576 "Parser.y"
  { yyVal = new TypeNode(TypeKind.Bool, 2, ((TokenPosition)yyVals[0+yyTop])); }
  break;
case 29:
#line 577 "Parser.y"
  { yyVal = new TypeNode(TypeKind.Bool, 3, ((TokenPosition)yyVals[0+yyTop])); }
  break;
case 30:
#line 578 "Parser.y"
  { yyVal = new TypeNode(TypeKind.Bool, 4, ((TokenPosition)yyVals[0+yyTop])); }
  break;
case 31:
#line 580 "Parser.y"
  { yyVal = new TypeNode(TypeKind.Float, 2, 2, ((TokenPosition)yyVals[0+yyTop])); }
  break;
case 32:
#line 581 "Parser.y"
  { yyVal = new TypeNode(TypeKind.Float, 2, 3, ((TokenPosition)yyVals[0+yyTop])); }
  break;
case 33:
#line 582 "Parser.y"
  { yyVal = new TypeNode(TypeKind.Float, 2, 4, ((TokenPosition)yyVals[0+yyTop])); }
  break;
case 34:
#line 583 "Parser.y"
  { yyVal = new TypeNode(TypeKind.Float, 3, 2, ((TokenPosition)yyVals[0+yyTop])); }
  break;
case 35:
#line 584 "Parser.y"
  { yyVal = new TypeNode(TypeKind.Float, 3, 3, ((TokenPosition)yyVals[0+yyTop])); }
  break;
case 36:
#line 585 "Parser.y"
  { yyVal = new TypeNode(TypeKind.Float, 3, 4, ((TokenPosition)yyVals[0+yyTop])); }
  break;
case 37:
#line 586 "Parser.y"
  { yyVal = new TypeNode(TypeKind.Float, 4, 2, ((TokenPosition)yyVals[0+yyTop])); }
  break;
case 38:
#line 587 "Parser.y"
  { yyVal = new TypeNode(TypeKind.Float, 4, 3, ((TokenPosition)yyVals[0+yyTop])); }
  break;
case 39:
#line 588 "Parser.y"
  { yyVal = new TypeNode(TypeKind.Float, 4, 4, ((TokenPosition)yyVals[0+yyTop])); }
  break;
case 40:
#line 590 "Parser.y"
  { yyVal = new TypeNode(TypeKind.Double, 2, 2, ((TokenPosition)yyVals[0+yyTop])); }
  break;
case 41:
#line 591 "Parser.y"
  { yyVal = new TypeNode(TypeKind.Double, 2, 3, ((TokenPosition)yyVals[0+yyTop])); }
  break;
case 42:
#line 592 "Parser.y"
  { yyVal = new TypeNode(TypeKind.Double, 2, 4, ((TokenPosition)yyVals[0+yyTop])); }
  break;
case 43:
#line 593 "Parser.y"
  { yyVal = new TypeNode(TypeKind.Double, 3, 2, ((TokenPosition)yyVals[0+yyTop])); }
  break;
case 44:
#line 594 "Parser.y"
  { yyVal = new TypeNode(TypeKind.Double, 3, 3, ((TokenPosition)yyVals[0+yyTop])); }
  break;
case 45:
#line 595 "Parser.y"
  { yyVal = new TypeNode(TypeKind.Double, 3, 4, ((TokenPosition)yyVals[0+yyTop])); }
  break;
case 46:
#line 596 "Parser.y"
  { yyVal = new TypeNode(TypeKind.Double, 4, 2, ((TokenPosition)yyVals[0+yyTop])); }
  break;
case 47:
#line 597 "Parser.y"
  { yyVal = new TypeNode(TypeKind.Double, 4, 3, ((TokenPosition)yyVals[0+yyTop])); }
  break;
case 48:
#line 598 "Parser.y"
  { yyVal = new TypeNode(TypeKind.Double, 4, 4, ((TokenPosition)yyVals[0+yyTop])); }
  break;
case 49:
#line 600 "Parser.y"
  { yyVal = new TypeNode(TypeKind.Int, 2, 2, ((TokenPosition)yyVals[0+yyTop])); }
  break;
case 50:
#line 601 "Parser.y"
  { yyVal = new TypeNode(TypeKind.Int, 2, 3, ((TokenPosition)yyVals[0+yyTop])); }
  break;
case 51:
#line 602 "Parser.y"
  { yyVal = new TypeNode(TypeKind.Int, 2, 4, ((TokenPosition)yyVals[0+yyTop])); }
  break;
case 52:
#line 603 "Parser.y"
  { yyVal = new TypeNode(TypeKind.Int, 3, 2, ((TokenPosition)yyVals[0+yyTop])); }
  break;
case 53:
#line 604 "Parser.y"
  { yyVal = new TypeNode(TypeKind.Int, 3, 3, ((TokenPosition)yyVals[0+yyTop])); }
  break;
case 54:
#line 605 "Parser.y"
  { yyVal = new TypeNode(TypeKind.Int, 3, 4, ((TokenPosition)yyVals[0+yyTop])); }
  break;
case 55:
#line 606 "Parser.y"
  { yyVal = new TypeNode(TypeKind.Int, 4, 2, ((TokenPosition)yyVals[0+yyTop])); }
  break;
case 56:
#line 607 "Parser.y"
  { yyVal = new TypeNode(TypeKind.Int, 4, 3, ((TokenPosition)yyVals[0+yyTop])); }
  break;
case 57:
#line 608 "Parser.y"
  { yyVal = new TypeNode(TypeKind.Int, 4, 4, ((TokenPosition)yyVals[0+yyTop])); }
  break;
case 58:
#line 611 "Parser.y"
  { yyVal = new MemberAccess(((Expression)yyVals[-2+yyTop]), (string)((TokenValue)yyVals[0+yyTop]).GetValue(), ((TokenPosition)yyVals[-1+yyTop])); }
  break;
case 59:
#line 612 "Parser.y"
  { yyVal = new VariableReference((string)((TokenValue)yyVals[0+yyTop]).GetValue(), ((TokenValue)yyVals[0+yyTop])); }
  break;
case 60:
#line 615 "Parser.y"
  { yyVal = new MemberAccess(((Expression)yyVals[-2+yyTop]), (string)((TokenValue)yyVals[0+yyTop]).GetValue(), ((TokenPosition)yyVals[-1+yyTop])); }
  break;
case 61:
#line 618 "Parser.y"
  { yyVal = new VariableReference((string)((TokenValue)yyVals[0+yyTop]).GetValue(), ((TokenValue)yyVals[0+yyTop])); }
  break;
case 62:
#line 619 "Parser.y"
  { yyVal = new VariableReference("this", ((TokenPosition)yyVals[0+yyTop])); }
  break;
case 63:
#line 620 "Parser.y"
  { yyVal = new BaseExpression(((TokenPosition)yyVals[0+yyTop])); }
  break;
case 64:
#line 623 "Parser.y"
  { yyVal = new ByteConstant((byte)(ulong)((TokenValue)yyVals[0+yyTop]).GetValue(), ((TokenValue)yyVals[0+yyTop])); }
  break;
case 65:
#line 624 "Parser.y"
  { yyVal = new SByteConstant((sbyte)(long)((TokenValue)yyVals[0+yyTop]).GetValue(), ((TokenValue)yyVals[0+yyTop])); }
  break;
case 66:
#line 625 "Parser.y"
  { yyVal = new ShortConstant((short)(long)((TokenValue)yyVals[0+yyTop]).GetValue(), ((TokenValue)yyVals[0+yyTop])); }
  break;
case 67:
#line 626 "Parser.y"
  { yyVal = new UShortConstant((ushort)(ulong)((TokenValue)yyVals[0+yyTop]).GetValue(), ((TokenValue)yyVals[0+yyTop])); }
  break;
case 68:
#line 627 "Parser.y"
  { yyVal = new IntegerConstant((int)(long)((TokenValue)yyVals[0+yyTop]).GetValue(), ((TokenValue)yyVals[0+yyTop])); }
  break;
case 69:
#line 628 "Parser.y"
  { yyVal = new UIntegerConstant((uint)(ulong)((TokenValue)yyVals[0+yyTop]).GetValue(), ((TokenValue)yyVals[0+yyTop])); }
  break;
case 70:
#line 629 "Parser.y"
  { yyVal = new LongConstant((long)((TokenValue)yyVals[0+yyTop]).GetValue(), ((TokenValue)yyVals[0+yyTop])); }
  break;
case 71:
#line 630 "Parser.y"
  { yyVal = new ULongConstant((ulong)((TokenValue)yyVals[0+yyTop]).GetValue(), ((TokenValue)yyVals[0+yyTop])); }
  break;
case 72:
#line 631 "Parser.y"
  { yyVal = new FloatConstant((float)(double)((TokenValue)yyVals[0+yyTop]).GetValue(), ((TokenValue)yyVals[0+yyTop])); }
  break;
case 73:
#line 632 "Parser.y"
  { yyVal = new DoubleConstant((double)((TokenValue)yyVals[0+yyTop]).GetValue(), ((TokenValue)yyVals[0+yyTop])); }
  break;
case 74:
#line 633 "Parser.y"
  { yyVal = new BoolConstant((bool)((TokenValue)yyVals[0+yyTop]).GetValue(), ((TokenValue)yyVals[0+yyTop])); }
  break;
case 75:
#line 634 "Parser.y"
  { yyVal = new NullConstant(((TokenPosition)yyVals[0+yyTop])); }
  break;
case 76:
#line 635 "Parser.y"
  { yyVal = new CharacterConstant((char)(long)((TokenValue)yyVals[0+yyTop]).GetValue(), ((TokenValue)yyVals[0+yyTop])); }
  break;
case 77:
#line 638 "Parser.y"
  { yyVal = new StringConstant((string)((TokenValue)yyVals[0+yyTop]).GetValue(), ((TokenValue)yyVals[0+yyTop])); }
  break;
case 78:
#line 639 "Parser.y"
  { yyVal = new CStringConstant((string)((TokenValue)yyVals[0+yyTop]).GetValue(), ((TokenValue)yyVals[0+yyTop])); }
  break;
case 79:
#line 642 "Parser.y"
  { yyVal = ((Expression)yyVals[0+yyTop]); }
  break;
case 80:
#line 643 "Parser.y"
  { yyVal = (Expression)AddList(((Expression)yyVals[-2+yyTop]), ((Expression)yyVals[0+yyTop])); }
  break;
case 81:
#line 646 "Parser.y"
  { yyVal = new SubscriptAccess(((Expression)yyVals[-3+yyTop]), ((Expression)yyVals[-1+yyTop]), ((TokenPosition)yyVals[-2+yyTop])); }
  break;
case 82:
#line 647 "Parser.y"
  { yyVal = new MakeArray(((Expression)yyVals[-3+yyTop]), ((int)yyVals[-1+yyTop]), ((Expression)yyVals[-3+yyTop]).GetPosition()); }
  break;
case 83:
#line 650 "Parser.y"
  { yyVal = new IndirectAccess(((Expression)yyVals[-2+yyTop]), (string)((TokenValue)yyVals[0+yyTop]).GetValue(), ((TokenPosition)yyVals[-1+yyTop])); }
  break;
case 84:
#line 653 "Parser.y"
  { yyVal = ((Expression)yyVals[0+yyTop]); }
  break;
case 85:
#line 654 "Parser.y"
  { yyVal = ((Expression)yyVals[0+yyTop]); }
  break;
case 86:
#line 655 "Parser.y"
  { yyVal = new GenericInstanceExpr(((Expression)yyVals[-3+yyTop]), ((AstNode)yyVals[-1+yyTop]), ((TokenPosition)yyVals[-2+yyTop])); }
  break;
case 87:
#line 656 "Parser.y"
  { yyVal = new GenericInstanceExpr(((Expression)yyVals[-3+yyTop]), ((AstNode)yyVals[-1+yyTop]), ((TokenPosition)yyVals[-2+yyTop])); }
  break;
case 88:
#line 657 "Parser.y"
  { yyVal = new MemberAccess(((Expression)yyVals[-2+yyTop]), (string)((TokenValue)yyVals[0+yyTop]).GetValue(), ((TokenPosition)yyVals[-1+yyTop])); }
  break;
case 89:
#line 658 "Parser.y"
  { yyVal = new IndirectAccess(((Expression)yyVals[-2+yyTop]), (string)((TokenValue)yyVals[0+yyTop]).GetValue(), ((TokenPosition)yyVals[-1+yyTop])); }
  break;
case 90:
#line 661 "Parser.y"
  { yyVal = ((Expression)yyVals[0+yyTop]); }
  break;
case 91:
#line 662 "Parser.y"
  { yyVal = new DereferenceOperation(((Expression)yyVals[0+yyTop]), ((Expression)yyVals[0+yyTop]).GetPosition()); }
  break;
case 92:
#line 665 "Parser.y"
  { yyVal = ((Expression)yyVals[0+yyTop]); }
  break;
case 93:
#line 666 "Parser.y"
  { yyVal = new MemberAccess(((Expression)yyVals[-2+yyTop]), (string)((TokenValue)yyVals[0+yyTop]).GetValue(), ((TokenPosition)yyVals[-1+yyTop])); }
  break;
case 94:
#line 667 "Parser.y"
  { yyVal = new IndirectAccess(((Expression)yyVals[-2+yyTop]), (string)((TokenValue)yyVals[0+yyTop]).GetValue(), ((TokenPosition)yyVals[-1+yyTop])); }
  break;
case 96:
#line 671 "Parser.y"
  { yyVal = ((Expression)yyVals[0+yyTop]); }
  break;
case 97:
#line 672 "Parser.y"
  { yyVal = new MakeConstant(((Expression)yyVals[0+yyTop]), ((TokenPosition)yyVals[-1+yyTop])); }
  break;
case 98:
#line 675 "Parser.y"
  { yyVal = 1; }
  break;
case 99:
#line 676 "Parser.y"
  { yyVal = ((int)yyVals[-1+yyTop]) + 1;}
  break;
case 100:
#line 679 "Parser.y"
  { yyVal = ((AstNode)yyVals[0+yyTop]); }
  break;
case 101:
#line 680 "Parser.y"
  { yyVal = new MakeConstant(new MakePointer(((Expression)yyVals[-2+yyTop]), ((Expression)yyVals[-2+yyTop]).GetPosition()), ((Expression)yyVals[-2+yyTop]).GetPosition()); }
  break;
case 102:
#line 681 "Parser.y"
  { yyVal = new MakePointer(((Expression)yyVals[-1+yyTop]), ((Expression)yyVals[-1+yyTop]).GetPosition()); }
  break;
case 103:
#line 682 "Parser.y"
  { yyVal = new MakeFunctionPointer(((Expression)yyVals[-5+yyTop]), ((Expression)yyVals[-1+yyTop]), ((MemberFlags)yyVals[-3+yyTop]), ((Expression)yyVals[-5+yyTop]).GetPosition()); }
  break;
case 104:
#line 685 "Parser.y"
  { yyVal = ((Expression)yyVals[0+yyTop]); }
  break;
case 105:
#line 686 "Parser.y"
  { yyVal = new MakeArray(((Expression)yyVals[-3+yyTop]), ((int)yyVals[-1+yyTop]), ((Expression)yyVals[-3+yyTop]).GetPosition()); }
  break;
case 106:
#line 687 "Parser.y"
  { yyVal = new SubscriptAccess(((Expression)yyVals[-3+yyTop]), ((Expression)yyVals[-1+yyTop]), ((TokenPosition)yyVals[-2+yyTop])); }
  break;
case 107:
#line 690 "Parser.y"
  { yyVal = ((Expression)yyVals[0+yyTop]); ((Expression)yyVals[0+yyTop]).SetHints(Expression.TypeHint); }
  break;
case 108:
#line 693 "Parser.y"
  { yyVal = ((Expression)yyVals[0+yyTop]); }
  break;
case 109:
#line 694 "Parser.y"
  { yyVal = new MakeConstant(((Expression)yyVals[0+yyTop]), ((TokenPosition)yyVals[-1+yyTop])); }
  break;
case 110:
#line 697 "Parser.y"
  { yyVal = ((Expression)yyVals[0+yyTop]); }
  break;
case 111:
#line 698 "Parser.y"
  { yyVal = ((Expression)yyVals[-1+yyTop]); }
  break;
case 112:
#line 701 "Parser.y"
  { yyVal = null; }
  break;
case 113:
#line 702 "Parser.y"
  { yyVal = ((Expression)yyVals[0+yyTop]); }
  break;
case 114:
#line 703 "Parser.y"
  { yyVal = AddList(((Expression)yyVals[-2+yyTop]), ((Expression)yyVals[0+yyTop])); }
  break;
case 115:
#line 706 "Parser.y"
  { yyVal = ((Expression)yyVals[0+yyTop]); }
  break;
case 116:
#line 707 "Parser.y"
  { yyVal = new ArrayExpression((Expression)((AstNode)yyVals[-1+yyTop]), ((TokenPosition)yyVals[-2+yyTop])); }
  break;
case 117:
#line 710 "Parser.y"
  { yyVal = ((Expression)yyVals[0+yyTop]); }
  break;
case 118:
#line 711 "Parser.y"
  { yyVal = AddList(((AstNode)yyVals[-2+yyTop]), ((Expression)yyVals[0+yyTop])); }
  break;
case 119:
#line 714 "Parser.y"
  { yyVal = null; }
  break;
case 120:
#line 715 "Parser.y"
  { yyVal = ((AstNode)yyVals[0+yyTop]);   }
  break;
case 121:
#line 716 "Parser.y"
  { yyVal = ((AstNode)yyVals[-1+yyTop]);   }
  break;
case 122:
#line 719 "Parser.y"
  { yyVal = new NewExpression(((Expression)yyVals[-3+yyTop]), ((Expression)yyVals[-1+yyTop]), ((TokenPosition)yyVals[-4+yyTop]));            }
  break;
case 123:
#line 720 "Parser.y"
  { yyVal = new NewArrayExpression(((Expression)yyVals[-3+yyTop]), ((Expression)yyVals[-1+yyTop]), null, -1, ((TokenPosition)yyVals[-4+yyTop])); }
  break;
case 124:
#line 721 "Parser.y"
  { yyVal = new NewArrayExpression(((Expression)yyVals[-6+yyTop]), ((Expression)yyVals[-4+yyTop]), ((AstNode)yyVals[-1+yyTop]), -1, ((TokenPosition)yyVals[-7+yyTop]));   }
  break;
case 125:
#line 722 "Parser.y"
  { yyVal = new NewArrayExpression(((Expression)yyVals[-6+yyTop]), null, ((AstNode)yyVals[-1+yyTop]), ((int)yyVals[-4+yyTop]), ((TokenPosition)yyVals[-7+yyTop])); }
  break;
case 126:
#line 725 "Parser.y"
  { yyVal = new NewRawExpression(((Expression)yyVals[0+yyTop]), null, true, ((TokenPosition)yyVals[-1+yyTop]));          }
  break;
case 127:
#line 726 "Parser.y"
  { yyVal = new NewRawExpression(((Expression)yyVals[-3+yyTop]), ((Expression)yyVals[-1+yyTop]), true, ((TokenPosition)yyVals[-4+yyTop]));            }
  break;
case 128:
#line 727 "Parser.y"
  { yyVal = new NewRawArrayExpression(((Expression)yyVals[-3+yyTop]), ((Expression)yyVals[-1+yyTop]), true, ((TokenPosition)yyVals[-4+yyTop]));    }
  break;
case 129:
#line 728 "Parser.y"
  { yyVal = new NewRawExpression(((Expression)yyVals[0+yyTop]), null, false, ((TokenPosition)yyVals[-1+yyTop]));          }
  break;
case 130:
#line 729 "Parser.y"
  { yyVal = new NewRawExpression(((Expression)yyVals[-3+yyTop]), ((Expression)yyVals[-1+yyTop]), false, ((TokenPosition)yyVals[-4+yyTop]));            }
  break;
case 131:
#line 730 "Parser.y"
  { yyVal = new NewRawArrayExpression(((Expression)yyVals[-3+yyTop]), ((Expression)yyVals[-1+yyTop]), false, ((TokenPosition)yyVals[-4+yyTop]));    }
  break;
case 132:
#line 733 "Parser.y"
  { yyVal = ((Expression)yyVals[-1+yyTop]); }
  break;
case 133:
#line 734 "Parser.y"
  { yyVal = ((Expression)yyVals[-1+yyTop]); }
  break;
case 134:
#line 737 "Parser.y"
  { yyVal = new PostfixOperation(PostfixOperation.Increment, ((Expression)yyVals[-1+yyTop]), ((TokenPosition)yyVals[0+yyTop])); }
  break;
case 135:
#line 738 "Parser.y"
  { yyVal = new PostfixOperation(PostfixOperation.Decrement, ((Expression)yyVals[-1+yyTop]), ((TokenPosition)yyVals[0+yyTop])); }
  break;
case 136:
  case_136();
  break;
case 137:
  case_137();
  break;
case 138:
#line 753 "Parser.y"
  { yyVal = new PrefixOperation(PrefixOperation.Increment, ((Expression)yyVals[0+yyTop]), ((TokenPosition)yyVals[-1+yyTop])); }
  break;
case 139:
#line 754 "Parser.y"
  { yyVal = new PrefixOperation(PrefixOperation.Decrement, ((Expression)yyVals[0+yyTop]), ((TokenPosition)yyVals[-1+yyTop])); }
  break;
case 140:
#line 757 "Parser.y"
  { yyVal = new ExpressionStatement(((Expression)yyVals[-1+yyTop]), ((Expression)yyVals[-1+yyTop]).GetPosition()); }
  break;
case 141:
#line 760 "Parser.y"
  { yyVal = ((Expression)yyVals[0+yyTop]); }
  break;
case 142:
#line 761 "Parser.y"
  { yyVal = ((Expression)yyVals[0+yyTop]); }
  break;
case 143:
#line 762 "Parser.y"
  { yyVal = ((Expression)yyVals[0+yyTop]); }
  break;
case 144:
#line 763 "Parser.y"
  { yyVal = ((Expression)yyVals[0+yyTop]); }
  break;
case 145:
#line 764 "Parser.y"
  { yyVal = ((Expression)yyVals[0+yyTop]);}
  break;
case 146:
#line 765 "Parser.y"
  { yyVal = ((Expression)yyVals[0+yyTop]); }
  break;
case 147:
#line 766 "Parser.y"
  { yyVal = ((Expression)yyVals[0+yyTop]); }
  break;
case 148:
#line 767 "Parser.y"
  { yyVal = ((Expression)yyVals[0+yyTop]); }
  break;
case 149:
#line 768 "Parser.y"
  { yyVal = ((Expression)yyVals[0+yyTop]); }
  break;
case 150:
#line 769 "Parser.y"
  { yyVal = ((Expression)yyVals[0+yyTop]); }
  break;
case 151:
#line 770 "Parser.y"
  { yyVal = ((Expression)yyVals[0+yyTop]); }
  break;
case 152:
#line 771 "Parser.y"
  { yyVal = ((Expression)yyVals[0+yyTop]); }
  break;
case 153:
#line 772 "Parser.y"
  { yyVal = ((Expression)yyVals[0+yyTop]); }
  break;
case 154:
#line 773 "Parser.y"
  { yyVal = ((Expression)yyVals[0+yyTop]); }
  break;
case 155:
#line 774 "Parser.y"
  { yyVal = ((Expression)yyVals[0+yyTop]); }
  break;
case 156:
#line 775 "Parser.y"
  { yyVal = ((Expression)yyVals[-1+yyTop]); }
  break;
case 157:
#line 778 "Parser.y"
  { yyVal = new SizeOfExpression(((Expression)yyVals[-1+yyTop]), ((TokenPosition)yyVals[-3+yyTop])); }
  break;
case 158:
#line 781 "Parser.y"
  { yyVal = new TypeOfExpression(((Expression)yyVals[-1+yyTop]), ((TokenPosition)yyVals[-3+yyTop])); }
  break;
case 159:
#line 784 "Parser.y"
  { yyVal = new DefaultExpression(((Expression)yyVals[-1+yyTop]), ((TokenPosition)yyVals[-3+yyTop])); }
  break;
case 160:
#line 787 "Parser.y"
  { yyVal = ((AstNode)yyVals[0+yyTop]); }
  break;
case 161:
#line 788 "Parser.y"
  { yyVal = new DereferenceOperation(((Expression)yyVals[0+yyTop]), ((Expression)yyVals[0+yyTop]).GetPosition()); }
  break;
case 162:
#line 791 "Parser.y"
  { yyVal = new ReinterpretCast(((Expression)yyVals[-4+yyTop]), ((Expression)yyVals[-1+yyTop]), ((TokenPosition)yyVals[-6+yyTop])); }
  break;
case 163:
#line 794 "Parser.y"
  { yyVal = MemberFlags.Default; }
  break;
case 164:
#line 795 "Parser.y"
  { yyVal = ((MemberFlagsAndMask)yyVals[0+yyTop]).flags;           }
  break;
case 165:
#line 798 "Parser.y"
  { yyVal = ((Expression)yyVals[0+yyTop]); }
  break;
case 166:
#line 799 "Parser.y"
  { yyVal = new MakeConstant(new MakePointer(((Expression)yyVals[-2+yyTop]), ((Expression)yyVals[-2+yyTop]).GetPosition()), ((Expression)yyVals[-2+yyTop]).GetPosition()); }
  break;
case 167:
#line 800 "Parser.y"
  { yyVal = new MakePointer(((Expression)yyVals[-1+yyTop]), ((Expression)yyVals[-1+yyTop]).GetPosition()); }
  break;
case 168:
#line 801 "Parser.y"
  { yyVal = new BinaryOperation(BinaryOperation.OpMul, ((Expression)yyVals[-2+yyTop]), ((Expression)yyVals[0+yyTop]), ((TokenPosition)yyVals[-1+yyTop])); }
  break;
case 169:
#line 802 "Parser.y"
  { yyVal = new MakeFunctionPointer(((Expression)yyVals[-5+yyTop]), ((Expression)yyVals[-1+yyTop]), ((MemberFlags)yyVals[-3+yyTop]), ((Expression)yyVals[-5+yyTop]).GetPosition()); }
  break;
case 170:
#line 805 "Parser.y"
  { yyVal = ((Expression)yyVals[0+yyTop]); }
  break;
case 171:
#line 806 "Parser.y"
  { yyVal = new UnaryOperation(UnaryOperation.OpNot, ((Expression)yyVals[0+yyTop]), ((TokenPosition)yyVals[-1+yyTop])); }
  break;
case 172:
#line 807 "Parser.y"
  { yyVal = new UnaryOperation(UnaryOperation.OpBitNot, ((Expression)yyVals[0+yyTop]), ((TokenPosition)yyVals[-1+yyTop])); }
  break;
case 173:
#line 808 "Parser.y"
  { yyVal = ((Expression)yyVals[0+yyTop]); }
  break;
case 174:
#line 809 "Parser.y"
  { yyVal = new UnaryOperation(UnaryOperation.OpNeg, ((Expression)yyVals[0+yyTop]), ((Expression)yyVals[0+yyTop]).GetPosition()); }
  break;
case 175:
#line 810 "Parser.y"
  { yyVal = new AddressOfOperation(((Expression)yyVals[0+yyTop]), ((TokenPosition)yyVals[-1+yyTop])); }
  break;
case 176:
#line 811 "Parser.y"
  { yyVal = new RefExpression(false, ((Expression)yyVals[0+yyTop]), ((TokenValue)yyVals[-1+yyTop])); }
  break;
case 177:
#line 812 "Parser.y"
  { yyVal = new RefExpression(true, ((Expression)yyVals[0+yyTop]), ((TokenValue)yyVals[-1+yyTop])); }
  break;
case 178:
#line 813 "Parser.y"
  { yyVal = new CastOperation(((Expression)yyVals[-2+yyTop]), ((Expression)yyVals[0+yyTop]), ((TokenPosition)yyVals[-3+yyTop])); }
  break;
case 179:
#line 814 "Parser.y"
  { yyVal = ((Expression)yyVals[-1+yyTop]); }
  break;
case 180:
#line 815 "Parser.y"
  { yyVal = ((Expression)yyVals[0+yyTop]); }
  break;
case 181:
#line 818 "Parser.y"
  { yyVal = ((Expression)yyVals[0+yyTop]); }
  break;
case 182:
#line 819 "Parser.y"
  { yyVal = new BinaryOperation(BinaryOperation.OpMul, ((Expression)yyVals[-2+yyTop]), ((Expression)yyVals[0+yyTop]), ((TokenPosition)yyVals[-1+yyTop])); }
  break;
case 183:
#line 820 "Parser.y"
  { yyVal = new BinaryOperation(BinaryOperation.OpDiv, ((Expression)yyVals[-2+yyTop]), ((Expression)yyVals[0+yyTop]), ((TokenPosition)yyVals[-1+yyTop])); }
  break;
case 184:
#line 821 "Parser.y"
  { yyVal = new BinaryOperation(BinaryOperation.OpMod, ((Expression)yyVals[-2+yyTop]), ((Expression)yyVals[0+yyTop]), ((TokenPosition)yyVals[-1+yyTop])); }
  break;
case 185:
#line 824 "Parser.y"
  { yyVal = ((Expression)yyVals[0+yyTop]); }
  break;
case 186:
#line 825 "Parser.y"
  { yyVal = new BinaryOperation(BinaryOperation.OpAdd, ((Expression)yyVals[-2+yyTop]), ((Expression)yyVals[0+yyTop]), ((TokenPosition)yyVals[-1+yyTop])); }
  break;
case 187:
#line 826 "Parser.y"
  { yyVal = new BinaryOperation(BinaryOperation.OpSub, ((Expression)yyVals[-2+yyTop]), ((Expression)yyVals[0+yyTop]), ((TokenPosition)yyVals[-1+yyTop])); }
  break;
case 188:
#line 829 "Parser.y"
  { yyVal = ((Expression)yyVals[0+yyTop]); }
  break;
case 189:
#line 830 "Parser.y"
  { yyVal = new BinaryOperation(BinaryOperation.OpBitLeft, ((Expression)yyVals[-2+yyTop]), ((Expression)yyVals[0+yyTop]), ((TokenPosition)yyVals[-1+yyTop])); }
  break;
case 190:
#line 831 "Parser.y"
  { yyVal = new BinaryOperation(BinaryOperation.OpBitRight, ((Expression)yyVals[-2+yyTop]), ((Expression)yyVals[0+yyTop]), ((TokenPosition)yyVals[-1+yyTop])); }
  break;
case 191:
#line 834 "Parser.y"
  { yyVal = ((Expression)yyVals[0+yyTop]); }
  break;
case 192:
#line 835 "Parser.y"
  { yyVal = new BinaryOperation(BinaryOperation.OpLT, ((Expression)yyVals[-2+yyTop]), ((Expression)yyVals[0+yyTop]), ((TokenPosition)yyVals[-1+yyTop])); }
  break;
case 193:
#line 836 "Parser.y"
  { yyVal = new BinaryOperation(BinaryOperation.OpLEQ, ((Expression)yyVals[-2+yyTop]), ((Expression)yyVals[0+yyTop]), ((TokenPosition)yyVals[-1+yyTop])); }
  break;
case 194:
#line 837 "Parser.y"
  { yyVal = new BinaryOperation(BinaryOperation.OpGEQ, ((Expression)yyVals[-2+yyTop]), ((Expression)yyVals[0+yyTop]), ((TokenPosition)yyVals[-1+yyTop])); }
  break;
case 195:
#line 838 "Parser.y"
  { yyVal = new BinaryOperation(BinaryOperation.OpGT, ((Expression)yyVals[-2+yyTop]), ((Expression)yyVals[0+yyTop]), ((TokenPosition)yyVals[-1+yyTop])); }
  break;
case 196:
#line 839 "Parser.y"
  { yyVal = new IsExpression(((Expression)yyVals[-2+yyTop]), ((Expression)yyVals[0+yyTop]), ((TokenPosition)yyVals[-1+yyTop])); }
  break;
case 197:
#line 840 "Parser.y"
  { yyVal = new AsExpression(((Expression)yyVals[-2+yyTop]), ((Expression)yyVals[0+yyTop]), ((TokenPosition)yyVals[-1+yyTop])); }
  break;
case 198:
#line 843 "Parser.y"
  { yyVal = ((Expression)yyVals[0+yyTop]); }
  break;
case 199:
#line 844 "Parser.y"
  { yyVal = new BinaryOperation(BinaryOperation.OpEQ, ((Expression)yyVals[-2+yyTop]), ((Expression)yyVals[0+yyTop]), ((TokenPosition)yyVals[-1+yyTop])); }
  break;
case 200:
#line 845 "Parser.y"
  { yyVal = new BinaryOperation(BinaryOperation.OpNEQ, ((Expression)yyVals[-2+yyTop]), ((Expression)yyVals[0+yyTop]), ((TokenPosition)yyVals[-1+yyTop])); }
  break;
case 201:
#line 848 "Parser.y"
  { yyVal = ((Expression)yyVals[0+yyTop]); }
  break;
case 202:
#line 849 "Parser.y"
  { yyVal = new BinaryOperation(BinaryOperation.OpBitAnd, ((Expression)yyVals[-2+yyTop]), ((Expression)yyVals[0+yyTop]), ((TokenPosition)yyVals[-1+yyTop])); }
  break;
case 203:
#line 850 "Parser.y"
  { yyVal = new BinaryOperation(BinaryOperation.OpBitOr, ((Expression)yyVals[-2+yyTop]), ((Expression)yyVals[0+yyTop]), ((TokenPosition)yyVals[-1+yyTop])); }
  break;
case 204:
#line 851 "Parser.y"
  { yyVal = new BinaryOperation(BinaryOperation.OpBitXor, ((Expression)yyVals[-2+yyTop]), ((Expression)yyVals[0+yyTop]), ((TokenPosition)yyVals[-1+yyTop])); }
  break;
case 205:
#line 854 "Parser.y"
  { yyVal = ((Expression)yyVals[0+yyTop]); }
  break;
case 206:
#line 855 "Parser.y"
  { yyVal = new BinaryOperation(BinaryOperation.OpLAnd, ((Expression)yyVals[-2+yyTop]), ((Expression)yyVals[0+yyTop]), ((TokenPosition)yyVals[-1+yyTop])); }
  break;
case 207:
#line 858 "Parser.y"
  { yyVal = ((Expression)yyVals[0+yyTop]); }
  break;
case 208:
#line 859 "Parser.y"
  { yyVal = new BinaryOperation(BinaryOperation.OpLOr, ((Expression)yyVals[-2+yyTop]), ((Expression)yyVals[0+yyTop]), ((TokenPosition)yyVals[-1+yyTop])); }
  break;
case 209:
#line 862 "Parser.y"
  { yyVal = ((Expression)yyVals[0+yyTop]);								   }
  break;
case 210:
#line 863 "Parser.y"
  { yyVal = new TernaryOperation(((Expression)yyVals[-4+yyTop]), ((Expression)yyVals[-2+yyTop]), ((Expression)yyVals[0+yyTop]), ((TokenPosition)yyVals[-3+yyTop])); }
  break;
case 211:
#line 866 "Parser.y"
  { yyVal = new AssignmentExpression(((Expression)yyVals[-2+yyTop]), ((Expression)yyVals[0+yyTop]), ((TokenPosition)yyVals[-1+yyTop])); }
  break;
case 212:
#line 867 "Parser.y"
  { yyVal = new BinaryAssignOperation(BinaryOperation.OpAdd, ((Expression)yyVals[-2+yyTop]), ((Expression)yyVals[0+yyTop]), ((TokenPosition)yyVals[-1+yyTop]));      }
  break;
case 213:
#line 868 "Parser.y"
  { yyVal = new BinaryAssignOperation(BinaryOperation.OpSub, ((Expression)yyVals[-2+yyTop]), ((Expression)yyVals[0+yyTop]), ((TokenPosition)yyVals[-1+yyTop]));      }
  break;
case 214:
#line 869 "Parser.y"
  { yyVal = new BinaryAssignOperation(BinaryOperation.OpMul, ((Expression)yyVals[-2+yyTop]), ((Expression)yyVals[0+yyTop]), ((TokenPosition)yyVals[-1+yyTop]));      }
  break;
case 215:
#line 870 "Parser.y"
  { yyVal = new BinaryAssignOperation(BinaryOperation.OpDiv, ((Expression)yyVals[-2+yyTop]), ((Expression)yyVals[0+yyTop]), ((TokenPosition)yyVals[-1+yyTop]));      }
  break;
case 216:
#line 871 "Parser.y"
  { yyVal = new BinaryAssignOperation(BinaryOperation.OpMod, ((Expression)yyVals[-2+yyTop]), ((Expression)yyVals[0+yyTop]), ((TokenPosition)yyVals[-1+yyTop]));      }
  break;
case 217:
#line 872 "Parser.y"
  { yyVal = new BinaryAssignOperation(BinaryOperation.OpBitOr, ((Expression)yyVals[-2+yyTop]), ((Expression)yyVals[0+yyTop]), ((TokenPosition)yyVals[-1+yyTop]));    }
  break;
case 218:
#line 873 "Parser.y"
  { yyVal = new BinaryAssignOperation(BinaryOperation.OpBitXor, ((Expression)yyVals[-2+yyTop]), ((Expression)yyVals[0+yyTop]), ((TokenPosition)yyVals[-1+yyTop]));   }
  break;
case 219:
#line 874 "Parser.y"
  { yyVal = new BinaryAssignOperation(BinaryOperation.OpBitAnd, ((Expression)yyVals[-2+yyTop]), ((Expression)yyVals[0+yyTop]), ((TokenPosition)yyVals[-1+yyTop]));   }
  break;
case 220:
#line 875 "Parser.y"
  { yyVal = new BinaryAssignOperation(BinaryOperation.OpBitLeft, ((Expression)yyVals[-2+yyTop]), ((Expression)yyVals[0+yyTop]), ((TokenPosition)yyVals[-1+yyTop]));  }
  break;
case 221:
#line 876 "Parser.y"
  { yyVal = new BinaryAssignOperation(BinaryOperation.OpBitRight, ((Expression)yyVals[-2+yyTop]), ((Expression)yyVals[0+yyTop]), ((TokenPosition)yyVals[-1+yyTop])); }
  break;
case 222:
#line 879 "Parser.y"
  { yyVal = new AssignmentExpression(((Expression)yyVals[-2+yyTop]), ((Expression)yyVals[0+yyTop]), ((TokenPosition)yyVals[-1+yyTop])); }
  break;
case 223:
#line 880 "Parser.y"
  { yyVal = new BinaryAssignOperation(BinaryOperation.OpAdd, ((Expression)yyVals[-2+yyTop]), ((Expression)yyVals[0+yyTop]), ((TokenPosition)yyVals[-1+yyTop]));      }
  break;
case 224:
#line 881 "Parser.y"
  { yyVal = new BinaryAssignOperation(BinaryOperation.OpSub, ((Expression)yyVals[-2+yyTop]), ((Expression)yyVals[0+yyTop]), ((TokenPosition)yyVals[-1+yyTop]));      }
  break;
case 225:
#line 882 "Parser.y"
  { yyVal = new BinaryAssignOperation(BinaryOperation.OpMul, ((Expression)yyVals[-2+yyTop]), ((Expression)yyVals[0+yyTop]), ((TokenPosition)yyVals[-1+yyTop]));      }
  break;
case 226:
#line 883 "Parser.y"
  { yyVal = new BinaryAssignOperation(BinaryOperation.OpDiv, ((Expression)yyVals[-2+yyTop]), ((Expression)yyVals[0+yyTop]), ((TokenPosition)yyVals[-1+yyTop]));      }
  break;
case 227:
#line 884 "Parser.y"
  { yyVal = new BinaryAssignOperation(BinaryOperation.OpMod, ((Expression)yyVals[-2+yyTop]), ((Expression)yyVals[0+yyTop]), ((TokenPosition)yyVals[-1+yyTop]));      }
  break;
case 228:
#line 885 "Parser.y"
  { yyVal = new BinaryAssignOperation(BinaryOperation.OpBitOr, ((Expression)yyVals[-2+yyTop]), ((Expression)yyVals[0+yyTop]), ((TokenPosition)yyVals[-1+yyTop]));    }
  break;
case 229:
#line 886 "Parser.y"
  { yyVal = new BinaryAssignOperation(BinaryOperation.OpBitXor, ((Expression)yyVals[-2+yyTop]), ((Expression)yyVals[0+yyTop]), ((TokenPosition)yyVals[-1+yyTop]));   }
  break;
case 230:
#line 887 "Parser.y"
  { yyVal = new BinaryAssignOperation(BinaryOperation.OpBitAnd, ((Expression)yyVals[-2+yyTop]), ((Expression)yyVals[0+yyTop]), ((TokenPosition)yyVals[-1+yyTop]));   }
  break;
case 231:
#line 888 "Parser.y"
  { yyVal = new BinaryAssignOperation(BinaryOperation.OpBitLeft, ((Expression)yyVals[-2+yyTop]), ((Expression)yyVals[0+yyTop]), ((TokenPosition)yyVals[-1+yyTop]));  }
  break;
case 232:
#line 889 "Parser.y"
  { yyVal = new BinaryAssignOperation(BinaryOperation.OpBitRight, ((Expression)yyVals[-2+yyTop]), ((Expression)yyVals[0+yyTop]), ((TokenPosition)yyVals[-1+yyTop])); }
  break;
case 233:
#line 892 "Parser.y"
  { yyVal = new ExpressionStatement(((Expression)yyVals[-1+yyTop]), ((Expression)yyVals[-1+yyTop]).GetPosition()); }
  break;
case 234:
#line 895 "Parser.y"
  { yyVal = ((Expression)yyVals[0+yyTop]); }
  break;
case 235:
#line 898 "Parser.y"
  { yyVal = ((Expression)yyVals[0+yyTop]); }
  break;
case 236:
#line 899 "Parser.y"
  { yyVal = ((Expression)yyVals[0+yyTop]); }
  break;
case 237:
#line 904 "Parser.y"
  { yyVal = new BlockNode(((AstNode)yyVals[-1+yyTop]), ((TokenPosition)yyVals[-2+yyTop]));}
  break;
case 238:
#line 907 "Parser.y"
  { yyVal = new UnsafeBlockNode(((AstNode)yyVals[-1+yyTop]), ((TokenPosition)yyVals[-3+yyTop])); }
  break;
case 239:
#line 910 "Parser.y"
  { yyVal = null;			}
  break;
case 240:
#line 911 "Parser.y"
  { yyVal = ((Expression)yyVals[0+yyTop]);				}
  break;
case 241:
#line 912 "Parser.y"
  { yyVal = AddList(((Expression)yyVals[-2+yyTop]), ((Expression)yyVals[0+yyTop])); }
  break;
case 242:
#line 915 "Parser.y"
  { yyVal = new CallExpression(((Expression)yyVals[-3+yyTop]), ((Expression)yyVals[-1+yyTop]), ((TokenPosition)yyVals[-2+yyTop])); }
  break;
case 243:
#line 918 "Parser.y"
  { yyVal = new CallExpression(((Expression)yyVals[-3+yyTop]), ((Expression)yyVals[-1+yyTop]), ((TokenPosition)yyVals[-2+yyTop])); }
  break;
case 244:
#line 921 "Parser.y"
  { yyVal = new ExpressionStatement(((Expression)yyVals[-1+yyTop]), ((TokenPosition)yyVals[0+yyTop])); }
  break;
case 245:
#line 924 "Parser.y"
  { yyVal = new ExpressionStatement(((Expression)yyVals[-1+yyTop]), ((Expression)yyVals[-1+yyTop]).GetPosition()); }
  break;
case 246:
#line 927 "Parser.y"
  { yyVal = new ReturnStatement(((Expression)yyVals[-1+yyTop]), ((TokenPosition)yyVals[-2+yyTop])); }
  break;
case 247:
#line 928 "Parser.y"
  { yyVal = new ReturnStatement(null, ((TokenPosition)yyVals[-1+yyTop])); }
  break;
case 248:
  case_248();
  break;
case 249:
#line 937 "Parser.y"
  { yyVal = new IfStatement(((Expression)yyVals[-2+yyTop]), ((AstNode)yyVals[0+yyTop]), null, ((TokenPosition)yyVals[-4+yyTop])); }
  break;
case 250:
#line 938 "Parser.y"
  { yyVal = new IfStatement(((Expression)yyVals[-4+yyTop]), ((AstNode)yyVals[-2+yyTop]), ((AstNode)yyVals[0+yyTop]), ((TokenPosition)yyVals[-6+yyTop])); }
  break;
case 251:
#line 941 "Parser.y"
  { yyVal = new CaseLabel(((Expression)yyVals[-2+yyTop]), ((AstNode)yyVals[0+yyTop]), ((TokenPosition)yyVals[-3+yyTop])); }
  break;
case 252:
#line 942 "Parser.y"
  { yyVal = new CaseLabel(null, ((AstNode)yyVals[0+yyTop]), ((TokenPosition)yyVals[-2+yyTop])); }
  break;
case 253:
#line 945 "Parser.y"
  { yyVal = ((AstNode)yyVals[0+yyTop]); }
  break;
case 254:
#line 946 "Parser.y"
  { yyVal = AddList(((AstNode)yyVals[-1+yyTop]), ((AstNode)yyVals[0+yyTop])); }
  break;
case 255:
#line 949 "Parser.y"
  { yyVal = new SwitchStatement(((Expression)yyVals[-4+yyTop]), ((AstNode)yyVals[-1+yyTop]), ((TokenPosition)yyVals[-6+yyTop])); }
  break;
case 256:
#line 952 "Parser.y"
  { yyVal = new WhileStatement(((Expression)yyVals[-2+yyTop]), ((AstNode)yyVals[0+yyTop]), ((TokenPosition)yyVals[-4+yyTop])); }
  break;
case 257:
#line 955 "Parser.y"
  { yyVal = new DoWhileStatement(((Expression)yyVals[-1+yyTop]), ((AstNode)yyVals[-4+yyTop]), ((TokenPosition)yyVals[-5+yyTop])); }
  break;
case 258:
#line 958 "Parser.y"
  { yyVal = null; }
  break;
case 259:
#line 959 "Parser.y"
  { yyVal = new ExpressionStatement(((Expression)yyVals[0+yyTop]), ((Expression)yyVals[0+yyTop]).GetPosition());; }
  break;
case 260:
#line 960 "Parser.y"
  { yyVal = new ExpressionStatement(((Expression)yyVals[0+yyTop]), ((Expression)yyVals[0+yyTop]).GetPosition());; }
  break;
case 261:
#line 961 "Parser.y"
  { yyVal = new ExpressionStatement(((Expression)yyVals[0+yyTop]), ((Expression)yyVals[0+yyTop]).GetPosition());; }
  break;
case 262:
#line 962 "Parser.y"
  { yyVal = new ExpressionStatement(((Expression)yyVals[0+yyTop]), ((Expression)yyVals[0+yyTop]).GetPosition());; }
  break;
case 263:
#line 965 "Parser.y"
  { yyVal = null; }
  break;
case 264:
#line 966 "Parser.y"
  { yyVal = ((Expression)yyVals[-1+yyTop]); }
  break;
case 265:
#line 969 "Parser.y"
  { yyVal = null; }
  break;
case 266:
#line 970 "Parser.y"
  { yyVal = ((AstNode)yyVals[0+yyTop]); }
  break;
case 267:
#line 973 "Parser.y"
  { yyVal = new ForStatement(((AstNode)yyVals[-4+yyTop]), ((Expression)yyVals[-3+yyTop]), ((AstNode)yyVals[-2+yyTop]), ((AstNode)yyVals[0+yyTop]), ((TokenPosition)yyVals[-6+yyTop])); }
  break;
case 268:
#line 977 "Parser.y"
  { yyVal = new ForEachStatement(((Expression)yyVals[-5+yyTop]), (string)((TokenValue)yyVals[-4+yyTop]).GetValue(), ((Expression)yyVals[-2+yyTop]), ((AstNode)yyVals[0+yyTop]), ((TokenPosition)yyVals[-7+yyTop])); }
  break;
case 269:
#line 980 "Parser.y"
  { yyVal = new BreakStatement(((TokenPosition)yyVals[-1+yyTop])); }
  break;
case 270:
#line 983 "Parser.y"
  { yyVal = new ContinueStatement(((TokenPosition)yyVals[-1+yyTop])); }
  break;
case 271:
#line 986 "Parser.y"
  { yyVal = new GotoCaseStatement(((Expression)yyVals[-1+yyTop]), ((TokenPosition)yyVals[-3+yyTop]));   }
  break;
case 272:
#line 987 "Parser.y"
  { yyVal = new GotoCaseStatement(null, ((TokenPosition)yyVals[-2+yyTop])); }
  break;
case 273:
#line 990 "Parser.y"
  { yyVal = new CatchStatement(((Expression)yyVals[-2+yyTop]), null, ((AstNode)yyVals[0+yyTop]), ((TokenPosition)yyVals[-4+yyTop])); }
  break;
case 274:
#line 991 "Parser.y"
  { yyVal = new CatchStatement(((Expression)yyVals[-3+yyTop]), (string)((TokenValue)yyVals[-2+yyTop]).GetValue(), ((AstNode)yyVals[0+yyTop]), ((TokenPosition)yyVals[-5+yyTop])); }
  break;
case 275:
#line 994 "Parser.y"
  { yyVal = ((AstNode)yyVals[0+yyTop]); }
  break;
case 276:
#line 995 "Parser.y"
  { yyVal = AddList(((AstNode)yyVals[-1+yyTop]), ((AstNode)yyVals[0+yyTop])); }
  break;
case 277:
#line 998 "Parser.y"
  { yyVal = new FinallyStatement(((AstNode)yyVals[0+yyTop]), ((TokenPosition)yyVals[-1+yyTop])); }
  break;
case 278:
#line 1001 "Parser.y"
  { yyVal = new TryStatement(((AstNode)yyVals[-2+yyTop]), ((AstNode)yyVals[-1+yyTop]), ((AstNode)yyVals[0+yyTop]), ((TokenPosition)yyVals[-3+yyTop])); }
  break;
case 279:
#line 1002 "Parser.y"
  { yyVal = new TryStatement(((AstNode)yyVals[-1+yyTop]), ((AstNode)yyVals[0+yyTop]), null, ((TokenPosition)yyVals[-2+yyTop])); }
  break;
case 280:
#line 1003 "Parser.y"
  { yyVal = new TryStatement(((AstNode)yyVals[-1+yyTop]), null, ((AstNode)yyVals[0+yyTop]), ((TokenPosition)yyVals[-2+yyTop])); }
  break;
case 281:
#line 1006 "Parser.y"
  {yyVal = new VariableDeclaration((string)((TokenValue)yyVals[0+yyTop]).GetValue(), null, ((TokenValue)yyVals[0+yyTop])); }
  break;
case 282:
#line 1007 "Parser.y"
  {yyVal = new VariableDeclaration((string)((TokenValue)yyVals[-2+yyTop]).GetValue(), ((Expression)yyVals[0+yyTop]), ((TokenValue)yyVals[-2+yyTop])); }
  break;
case 283:
#line 1010 "Parser.y"
  { yyVal = ((AstNode)yyVals[0+yyTop]);				}
  break;
case 284:
#line 1011 "Parser.y"
  { yyVal = AddList(((AstNode)yyVals[-2+yyTop]), ((AstNode)yyVals[0+yyTop])); }
  break;
case 285:
#line 1014 "Parser.y"
  { yyVal = new LocalVariablesDeclaration(((Expression)yyVals[-2+yyTop]), (VariableDeclaration)((AstNode)yyVals[-1+yyTop]), ((Expression)yyVals[-2+yyTop]).GetPosition()); }
  break;
case 286:
#line 1017 "Parser.y"
  { yyVal = new LockStatement(((Expression)yyVals[-2+yyTop]), ((AstNode)yyVals[0+yyTop]), ((TokenPosition)yyVals[-4+yyTop])); }
  break;
case 287:
#line 1020 "Parser.y"
  { yyVal = new DeleteStatement(((Expression)yyVals[-1+yyTop]), ((TokenPosition)yyVals[-2+yyTop])); }
  break;
case 288:
#line 1021 "Parser.y"
  { yyVal = new DeleteRawArrayStatement(((Expression)yyVals[-1+yyTop]), ((TokenPosition)yyVals[-4+yyTop])); }
  break;
case 289:
#line 1024 "Parser.y"
  { yyVal = new ThrowStatement(((Expression)yyVals[-1+yyTop]), ((TokenPosition)yyVals[-2+yyTop])); }
  break;
case 290:
  case_290();
  break;
case 291:
#line 1034 "Parser.y"
  { yyVal = new FixedVariableDecl((string)((TokenValue)yyVals[-2+yyTop]).GetValue(), ((Expression)yyVals[0+yyTop]), ((TokenValue)yyVals[-2+yyTop]));}
  break;
case 292:
#line 1037 "Parser.y"
  { yyVal = ((AstNode)yyVals[0+yyTop]); }
  break;
case 293:
#line 1038 "Parser.y"
  { yyVal = AddList(((AstNode)yyVals[-2+yyTop]), ((AstNode)yyVals[0+yyTop])); }
  break;
case 294:
#line 1042 "Parser.y"
  { yyVal = new FixedStatement(((Expression)yyVals[-3+yyTop]), ((AstNode)yyVals[-2+yyTop]), ((AstNode)yyVals[0+yyTop]), ((TokenPosition)yyVals[-5+yyTop])); }
  break;
case 295:
#line 1045 "Parser.y"
  { yyVal = new NullStatement(((TokenPosition)yyVals[0+yyTop])); }
  break;
case 296:
#line 1046 "Parser.y"
  { yyVal = ((AstNode)yyVals[0+yyTop]); }
  break;
case 297:
#line 1047 "Parser.y"
  { yyVal = ((AstNode)yyVals[0+yyTop]); }
  break;
case 298:
#line 1048 "Parser.y"
  { yyVal = ((AstNode)yyVals[0+yyTop]); }
  break;
case 299:
#line 1049 "Parser.y"
  { yyVal = ((AstNode)yyVals[0+yyTop]);}
  break;
case 300:
#line 1050 "Parser.y"
  { yyVal = ((AstNode)yyVals[0+yyTop]); }
  break;
case 301:
#line 1051 "Parser.y"
  { yyVal = ((AstNode)yyVals[0+yyTop]); }
  break;
case 302:
#line 1052 "Parser.y"
  { yyVal = ((AstNode)yyVals[0+yyTop]); }
  break;
case 303:
#line 1053 "Parser.y"
  { yyVal = ((AstNode)yyVals[0+yyTop]); }
  break;
case 304:
#line 1054 "Parser.y"
  { yyVal = ((AstNode)yyVals[0+yyTop]); }
  break;
case 305:
#line 1055 "Parser.y"
  { yyVal = ((AstNode)yyVals[0+yyTop]); }
  break;
case 306:
#line 1056 "Parser.y"
  { yyVal = ((AstNode)yyVals[0+yyTop]); }
  break;
case 307:
#line 1057 "Parser.y"
  { yyVal = ((AstNode)yyVals[0+yyTop]); }
  break;
case 308:
#line 1058 "Parser.y"
  { yyVal = ((AstNode)yyVals[0+yyTop]); }
  break;
case 309:
#line 1059 "Parser.y"
  { yyVal = ((AstNode)yyVals[0+yyTop]); }
  break;
case 310:
#line 1060 "Parser.y"
  { yyVal = ((AstNode)yyVals[0+yyTop]); }
  break;
case 311:
#line 1061 "Parser.y"
  { yyVal = ((AstNode)yyVals[0+yyTop]); }
  break;
case 312:
#line 1062 "Parser.y"
  { yyVal = ((AstNode)yyVals[0+yyTop]); }
  break;
case 313:
#line 1063 "Parser.y"
  { yyVal = ((AstNode)yyVals[0+yyTop]); }
  break;
case 314:
#line 1064 "Parser.y"
  { yyVal = ((AstNode)yyVals[0+yyTop]); }
  break;
case 315:
#line 1065 "Parser.y"
  { yyVal = ((AstNode)yyVals[0+yyTop]); }
  break;
case 316:
#line 1066 "Parser.y"
  { yyVal = ((AstNode)yyVals[0+yyTop]); }
  break;
case 317:
#line 1067 "Parser.y"
  { yyVal = ((AstNode)yyVals[0+yyTop]); }
  break;
case 318:
#line 1068 "Parser.y"
  { yyVal = ((AstNode)yyVals[0+yyTop]); }
  break;
case 319:
#line 1069 "Parser.y"
  { yyVal = ((AstNode)yyVals[0+yyTop]); }
  break;
case 320:
#line 1072 "Parser.y"
  { yyVal = null; }
  break;
case 321:
#line 1073 "Parser.y"
  { yyVal = AddList(((AstNode)yyVals[-1+yyTop]), ((AstNode)yyVals[0+yyTop])); }
  break;
case 322:
  case_322();
  break;
case 323:
#line 1091 "Parser.y"
  { yyVal = new AttributeArgument(((Expression)yyVals[0+yyTop]), (string)((TokenValue)yyVals[-2+yyTop]).GetValue(), ((TokenValue)yyVals[-2+yyTop])); }
  break;
case 324:
#line 1092 "Parser.y"
  { yyVal = new AttributeArgument(((Expression)yyVals[0+yyTop]), null, ((Expression)yyVals[0+yyTop]).GetPosition()); }
  break;
case 325:
#line 1095 "Parser.y"
  { yyVal = ((AstNode)yyVals[0+yyTop]); }
  break;
case 326:
#line 1096 "Parser.y"
  { yyVal = AddList(((AstNode)yyVals[-2+yyTop]), ((AstNode)yyVals[0+yyTop])); }
  break;
case 327:
#line 1099 "Parser.y"
  { yyVal = null; }
  break;
case 328:
#line 1100 "Parser.y"
  { yyVal = ((AstNode)yyVals[0+yyTop]);   }
  break;
case 329:
#line 1102 "Parser.y"
  { yyVal = new AttributeInstance(((Expression)yyVals[-3+yyTop]), (AttributeArgument)((AstNode)yyVals[-1+yyTop]), ((Expression)yyVals[-3+yyTop]).GetPosition());   }
  break;
case 330:
#line 1103 "Parser.y"
  { yyVal = new AttributeInstance(((Expression)yyVals[0+yyTop]), null, ((Expression)yyVals[0+yyTop]).GetPosition()); }
  break;
case 331:
#line 1106 "Parser.y"
  { yyVal = ((AstNode)yyVals[0+yyTop]); }
  break;
case 332:
#line 1107 "Parser.y"
  { yyVal = AddList(((AstNode)yyVals[-2+yyTop]), ((AstNode)yyVals[0+yyTop])); }
  break;
case 333:
#line 1110 "Parser.y"
  { yyVal = new ArgTypeAndFlags(((Expression)yyVals[0+yyTop])); }
  break;
case 334:
#line 1111 "Parser.y"
  { yyVal = new ArgTypeAndFlags(new MakeReference(((Expression)yyVals[-1+yyTop]), ReferenceFlow.In,    true,  ((TokenPosition)yyVals[0+yyTop])), ((Expression)yyVals[-1+yyTop]).GetPosition()); }
  break;
case 335:
#line 1112 "Parser.y"
  { yyVal = new ArgTypeAndFlags(new MakeReference(((Expression)yyVals[0+yyTop]), ReferenceFlow.InOut, false, ((TokenValue)yyVals[-1+yyTop])), ((TokenValue)yyVals[-1+yyTop])); }
  break;
case 336:
#line 1113 "Parser.y"
  { yyVal = new ArgTypeAndFlags(new MakeReference(((Expression)yyVals[-1+yyTop]), ReferenceFlow.InOut, true,  ((TokenValue)yyVals[-2+yyTop])), ((TokenValue)yyVals[-2+yyTop])); }
  break;
case 337:
#line 1114 "Parser.y"
  { yyVal = new ArgTypeAndFlags(new MakeReference(((Expression)yyVals[0+yyTop]), ReferenceFlow.Out,   false, ((TokenValue)yyVals[-1+yyTop])), ((TokenValue)yyVals[-1+yyTop])); }
  break;
case 338:
#line 1115 "Parser.y"
  { yyVal = new ArgTypeAndFlags(new MakeReference(((Expression)yyVals[-1+yyTop]), ReferenceFlow.Out,   true,  ((TokenValue)yyVals[-2+yyTop])), ((TokenValue)yyVals[-2+yyTop])); }
  break;
case 339:
#line 1116 "Parser.y"
  { yyVal = new ArgTypeAndFlags(((Expression)yyVals[0+yyTop]), ((TokenValue)yyVals[-1+yyTop]), true); }
  break;
case 340:
  case_340();
  break;
case 341:
#line 1127 "Parser.y"
  { yyVal = new GenericParameter((string)((TokenValue)yyVals[0+yyTop]).GetValue(), ((TokenValue)yyVals[0+yyTop])); }
  break;
case 342:
#line 1130 "Parser.y"
  { yyVal = ((GenericParameter)yyVals[0+yyTop]); }
  break;
case 343:
#line 1131 "Parser.y"
  { yyVal = (GenericParameter)AddList(((GenericParameter)yyVals[-2+yyTop]), ((GenericParameter)yyVals[0+yyTop])); }
  break;
case 344:
#line 1134 "Parser.y"
  { yyVal = new ConstraintChain(false, false, ((Expression)yyVals[0+yyTop])); }
  break;
case 345:
#line 1135 "Parser.y"
  { yyVal = new ConstraintChain(true, false, null); }
  break;
case 346:
#line 1136 "Parser.y"
  { yyVal = new ConstraintChain(false, true, null); }
  break;
case 347:
#line 1139 "Parser.y"
  { yyVal = ((ConstraintChain)yyVals[0+yyTop]); }
  break;
case 348:
  case_348();
  break;
case 349:
  case_349();
  break;
case 350:
#line 1157 "Parser.y"
  { yyVal = null; }
  break;
case 351:
#line 1158 "Parser.y"
  { yyVal = AddList(((GenericConstraint)yyVals[-1+yyTop]), ((GenericConstraint)yyVals[0+yyTop])); }
  break;
case 352:
#line 1161 "Parser.y"
  { yyVal = null; }
  break;
case 353:
#line 1162 "Parser.y"
  { yyVal = new GenericSignature(((GenericParameter)yyVals[-1+yyTop]), null, ((TokenPosition)yyVals[-2+yyTop])); }
  break;
case 354:
#line 1165 "Parser.y"
  { yyVal = ((Expression)yyVals[0+yyTop]); }
  break;
case 355:
#line 1166 "Parser.y"
  { yyVal = AddList(((AstNode)yyVals[-2+yyTop]), ((Expression)yyVals[0+yyTop])); }
  break;
case 356:
#line 1170 "Parser.y"
  { yyVal = new FunctionArgument(((ArgTypeAndFlags)yyVals[0+yyTop]).type, ((ArgTypeAndFlags)yyVals[0+yyTop]).isParams, "", ((ArgTypeAndFlags)yyVals[0+yyTop])); }
  break;
case 357:
#line 1171 "Parser.y"
  { yyVal = new FunctionArgument(((ArgTypeAndFlags)yyVals[-1+yyTop]).type, ((ArgTypeAndFlags)yyVals[-1+yyTop]).isParams, (string)((TokenValue)yyVals[0+yyTop]).GetValue(), ((ArgTypeAndFlags)yyVals[-1+yyTop])); }
  break;
case 358:
#line 1174 "Parser.y"
  { yyVal = ((AstNode)yyVals[0+yyTop]);              }
  break;
case 359:
#line 1175 "Parser.y"
  { yyVal = AddList(((AstNode)yyVals[-2+yyTop]), ((AstNode)yyVals[0+yyTop])); }
  break;
case 360:
#line 1178 "Parser.y"
  { yyVal = null; }
  break;
case 361:
#line 1179 "Parser.y"
  { yyVal = ((AstNode)yyVals[0+yyTop]);   }
  break;
case 362:
#line 1182 "Parser.y"
  { yyVal = "Op_Add"; }
  break;
case 363:
#line 1183 "Parser.y"
  { yyVal = "Op_Sub"; }
  break;
case 364:
#line 1184 "Parser.y"
  { yyVal = "Op_Mul"; }
  break;
case 365:
#line 1185 "Parser.y"
  { yyVal = "Op_Div"; }
  break;
case 366:
#line 1186 "Parser.y"
  { yyVal = "Op_Mod"; }
  break;
case 367:
#line 1187 "Parser.y"
  { yyVal = "Op_Lt";  }
  break;
case 368:
#line 1188 "Parser.y"
  { yyVal = "Op_Gt";  }
  break;
case 369:
#line 1189 "Parser.y"
  { yyVal = "Op_Leq"; }
  break;
case 370:
#line 1190 "Parser.y"
  { yyVal = "Op_Geq"; }
  break;
case 371:
#line 1191 "Parser.y"
  { yyVal = "Op_Eq";  }
  break;
case 372:
#line 1192 "Parser.y"
  { yyVal = "Op_Neq"; }
  break;
case 373:
#line 1193 "Parser.y"
  { yyVal = "Op_And"; }
  break;
case 374:
#line 1194 "Parser.y"
  { yyVal = "Op_Xor"; }
  break;
case 375:
#line 1195 "Parser.y"
  { yyVal = "Op_Or";  }
  break;
case 376:
#line 1196 "Parser.y"
  { yyVal = "Op_Not"; }
  break;
case 377:
#line 1199 "Parser.y"
  { yyVal = (string)((TokenValue)yyVals[0+yyTop]).GetValue(); }
  break;
case 378:
  case_378();
  break;
case 379:
  case_379();
  break;
case 380:
  case_380();
  break;
case 381:
  case_381();
  break;
case 382:
#line 1239 "Parser.y"
  { yyVal = new FunctionDefinition((FunctionPrototype)((AstNode)yyVals[-1+yyTop]), ((AstNode)yyVals[0+yyTop]), ((AstNode)yyVals[-1+yyTop]).GetPosition()); }
  break;
case 383:
#line 1242 "Parser.y"
  { yyVal = null; }
  break;
case 384:
#line 1243 "Parser.y"
  { yyVal = new ConstructorInitializer(true, ((Expression)yyVals[-1+yyTop]), ((TokenPosition)yyVals[-3+yyTop])); }
  break;
case 385:
#line 1244 "Parser.y"
  { yyVal = new ConstructorInitializer(false, ((Expression)yyVals[-1+yyTop]), ((TokenPosition)yyVals[-3+yyTop])); }
  break;
case 386:
  case_386();
  break;
case 387:
  case_387();
  break;
case 388:
  case_388();
  break;
case 389:
  case_389();
  break;
case 390:
#line 1291 "Parser.y"
  { yyVal = new FunctionDefinition((FunctionPrototype)((AstNode)yyVals[-1+yyTop]), ((AstNode)yyVals[0+yyTop]), ((AstNode)yyVals[-1+yyTop]).GetPosition()); }
  break;
case 391:
  case_391();
  break;
case 392:
#line 1305 "Parser.y"
  { yyVal = new FunctionDefinition((FunctionPrototype)((AstNode)yyVals[-1+yyTop]), null, ((AstNode)yyVals[-1+yyTop]).GetPosition());}
  break;
case 393:
#line 1308 "Parser.y"
  { yyVal = new MemberFlagsAndMask(MemberFlags.Public, MemberFlags.VisibilityMask, ((TokenPosition)yyVals[0+yyTop])); }
  break;
case 394:
#line 1309 "Parser.y"
  { yyVal = new MemberFlagsAndMask(MemberFlags.Internal, MemberFlags.VisibilityMask, ((TokenPosition)yyVals[0+yyTop])); }
  break;
case 395:
#line 1310 "Parser.y"
  { yyVal = new MemberFlagsAndMask(MemberFlags.Protected, MemberFlags.VisibilityMask, ((TokenPosition)yyVals[0+yyTop])); }
  break;
case 396:
#line 1311 "Parser.y"
  { yyVal = new MemberFlagsAndMask(MemberFlags.ProtectedInternal, MemberFlags.VisibilityMask, ((TokenPosition)yyVals[-1+yyTop])); }
  break;
case 397:
#line 1312 "Parser.y"
  { yyVal = new MemberFlagsAndMask(MemberFlags.Private, MemberFlags.VisibilityMask, ((TokenPosition)yyVals[0+yyTop])); }
  break;
case 398:
#line 1315 "Parser.y"
  { yyVal = new MemberFlagsAndMask(MemberFlags.Cdecl,   MemberFlags.LanguageMask, ((TokenPosition)yyVals[0+yyTop])); }
  break;
case 399:
#line 1316 "Parser.y"
  { yyVal = new MemberFlagsAndMask(MemberFlags.StdCall, MemberFlags.LanguageMask, ((TokenPosition)yyVals[0+yyTop])); }
  break;
case 400:
#line 1317 "Parser.y"
  { yyVal = new MemberFlagsAndMask(MemberFlags.ApiCall, MemberFlags.LanguageMask, ((TokenPosition)yyVals[0+yyTop])); }
  break;
case 401:
#line 1318 "Parser.y"
  { yyVal = new MemberFlagsAndMask(MemberFlags.Kernel,  MemberFlags.LanguageMask, ((TokenPosition)yyVals[0+yyTop])); }
  break;
case 402:
#line 1321 "Parser.y"
  { yyVal = new MemberFlagsAndMask(MemberFlags.Static, MemberFlags.InstanceMask, ((TokenPosition)yyVals[0+yyTop]));   }
  break;
case 403:
#line 1322 "Parser.y"
  { yyVal = new MemberFlagsAndMask(MemberFlags.Virtual, MemberFlags.InstanceMask, ((TokenPosition)yyVals[0+yyTop]));  }
  break;
case 404:
#line 1323 "Parser.y"
  { yyVal = new MemberFlagsAndMask(MemberFlags.Override, MemberFlags.InstanceMask, ((TokenPosition)yyVals[0+yyTop])); }
  break;
case 405:
#line 1324 "Parser.y"
  { yyVal = new MemberFlagsAndMask(MemberFlags.Abstract, MemberFlags.InstanceMask, ((TokenPosition)yyVals[0+yyTop])); }
  break;
case 406:
#line 1327 "Parser.y"
  { yyVal = new MemberFlagsAndMask(MemberFlags.External, MemberFlags.InstanceMask, ((TokenPosition)yyVals[0+yyTop])); }
  break;
case 407:
#line 1330 "Parser.y"
  { yyVal = new MemberFlagsAndMask(MemberFlags.ReadOnly, MemberFlags.AccessMask, ((TokenPosition)yyVals[0+yyTop])); }
  break;
case 408:
#line 1333 "Parser.y"
  { yyVal = new MemberFlagsAndMask(MemberFlags.Unsafe, MemberFlags.SecurityMask, ((TokenPosition)yyVals[0+yyTop])); }
  break;
case 409:
#line 1336 "Parser.y"
  { yyVal = new MemberFlagsAndMask(MemberFlags.Partial, MemberFlags.ImplFlagMask, ((TokenPosition)yyVals[0+yyTop])); }
  break;
case 410:
#line 1339 "Parser.y"
  { yyVal = new MemberFlagsAndMask(MemberFlags.Sealed, MemberFlags.InheritanceMask, ((TokenPosition)yyVals[0+yyTop])); }
  break;
case 411:
#line 1342 "Parser.y"
  { yyVal = ((MemberFlagsAndMask)yyVals[0+yyTop]); }
  break;
case 412:
#line 1343 "Parser.y"
  { yyVal = ((MemberFlagsAndMask)yyVals[0+yyTop]); }
  break;
case 413:
#line 1344 "Parser.y"
  { yyVal = ((MemberFlagsAndMask)yyVals[0+yyTop]); }
  break;
case 414:
#line 1345 "Parser.y"
  { yyVal = ((MemberFlagsAndMask)yyVals[0+yyTop]); }
  break;
case 415:
#line 1346 "Parser.y"
  { yyVal = ((MemberFlagsAndMask)yyVals[0+yyTop]); }
  break;
case 416:
#line 1347 "Parser.y"
  { yyVal = ((MemberFlagsAndMask)yyVals[0+yyTop]); }
  break;
case 417:
#line 1348 "Parser.y"
  { yyVal = ((MemberFlagsAndMask)yyVals[0+yyTop]); }
  break;
case 418:
#line 1349 "Parser.y"
  { yyVal = ((MemberFlagsAndMask)yyVals[0+yyTop]); }
  break;
case 419:
#line 1352 "Parser.y"
  { yyVal = ((MemberFlagsAndMask)yyVals[0+yyTop]); }
  break;
case 420:
  case_420();
  break;
case 421:
#line 1361 "Parser.y"
  { yyVal = MemberFlags.Default; }
  break;
case 422:
#line 1362 "Parser.y"
  { yyVal = ((MemberFlagsAndMask)yyVals[0+yyTop]).flags; }
  break;
case 423:
  case_423();
  break;
case 424:
#line 1373 "Parser.y"
  { yyVal = ((MemberFlags)yyVals[0+yyTop]); }
  break;
case 425:
#line 1376 "Parser.y"
  { yyVal = new FieldDeclaration((string)((TokenValue)yyVals[-2+yyTop]).GetValue(), ((Expression)yyVals[0+yyTop]), ((TokenValue)yyVals[-2+yyTop])); }
  break;
case 426:
#line 1377 "Parser.y"
  { yyVal = new FieldDeclaration((string)((TokenValue)yyVals[0+yyTop]).GetValue(), null, ((TokenValue)yyVals[0+yyTop])); }
  break;
case 427:
#line 1380 "Parser.y"
  { yyVal = ((AstNode)yyVals[0+yyTop]); }
  break;
case 428:
#line 1381 "Parser.y"
  { yyVal = AddList(((AstNode)yyVals[-2+yyTop]), ((AstNode)yyVals[0+yyTop])); }
  break;
case 429:
#line 1384 "Parser.y"
  { yyVal = new FieldDefinition(((MemberFlags)yyVals[-3+yyTop]), ((Expression)yyVals[-2+yyTop]), (FieldDeclaration)((AstNode)yyVals[-1+yyTop]), ((Expression)yyVals[-2+yyTop]).GetPosition()); }
  break;
case 430:
#line 1387 "Parser.y"
  { yyVal = MemberFlags.ImplicitVis; }
  break;
case 431:
#line 1388 "Parser.y"
  { yyVal = ((MemberFlagsAndMask)yyVals[0+yyTop]); }
  break;
case 432:
  case_432();
  break;
case 433:
  case_433();
  break;
case 434:
#line 1413 "Parser.y"
  { yyVal = ((AstNode)yyVals[0+yyTop]); }
  break;
case 435:
#line 1414 "Parser.y"
  { yyVal = AddList(((AstNode)yyVals[-1+yyTop]), ((AstNode)yyVals[0+yyTop])); }
  break;
case 436:
#line 1417 "Parser.y"
  { yyVal = new FunctionArgument(((Expression)yyVals[-1+yyTop]), (string)((TokenValue)yyVals[0+yyTop]).GetValue(), ((Expression)yyVals[-1+yyTop]).GetPosition()); }
  break;
case 437:
#line 1420 "Parser.y"
  { yyVal = ((AstNode)yyVals[0+yyTop]); }
  break;
case 438:
#line 1421 "Parser.y"
  { yyVal = AddList(((AstNode)yyVals[-2+yyTop]), ((AstNode)yyVals[0+yyTop]));}
  break;
case 439:
  case_439();
  break;
case 440:
  case_440();
  break;
case 441:
#line 1440 "Parser.y"
  { yyVal = new PropertyDefinition(((MemberFlags)yyVals[-8+yyTop]), ((Expression)yyVals[-7+yyTop]), "this", ((AstNode)yyVals[-4+yyTop]), ((AstNode)yyVals[-1+yyTop]), ((Expression)yyVals[-7+yyTop]).GetPosition()); }
  break;
case 442:
#line 1444 "Parser.y"
  { yyVal = new GetAccessorDefinition(((MemberFlags)yyVals[-2+yyTop]), null, ((TokenValue)yyVals[-1+yyTop]));}
  break;
case 443:
  case_443();
  break;
case 444:
#line 1456 "Parser.y"
  { yyVal = ((AstNode)yyVals[0+yyTop]); }
  break;
case 445:
#line 1457 "Parser.y"
  { yyVal = AddList(((AstNode)yyVals[-1+yyTop]), ((AstNode)yyVals[0+yyTop])); }
  break;
case 446:
#line 1461 "Parser.y"
  { yyVal = new PropertyDefinition(MemberFlags.InterfaceMember, ((Expression)yyVals[-4+yyTop]), (string)((TokenValue)yyVals[-3+yyTop]).GetValue(), null, ((AstNode)yyVals[-1+yyTop]), ((Expression)yyVals[-4+yyTop]).GetPosition()); }
  break;
case 447:
#line 1463 "Parser.y"
  { yyVal = new PropertyDefinition(MemberFlags.InterfaceMember, ((Expression)yyVals[-7+yyTop]), "this", ((AstNode)yyVals[-4+yyTop]), ((AstNode)yyVals[-1+yyTop]), ((Expression)yyVals[-7+yyTop]).GetPosition()); }
  break;
case 448:
#line 1466 "Parser.y"
  { yyVal = new EventAccessorDefinition(((MemberFlags)yyVals[-2+yyTop]), (string)((TokenValue)yyVals[-1+yyTop]).GetValue(), ((AstNode)yyVals[0+yyTop]), ((TokenValue)yyVals[-1+yyTop])); }
  break;
case 449:
#line 1467 "Parser.y"
  { yyVal = new EventAccessorDefinition(((MemberFlags)yyVals[-2+yyTop]), (string)((TokenValue)yyVals[-1+yyTop]).GetValue(), null, ((TokenValue)yyVals[-1+yyTop]));}
  break;
case 450:
#line 1470 "Parser.y"
  { yyVal = ((AstNode)yyVals[0+yyTop]); }
  break;
case 451:
#line 1471 "Parser.y"
  { yyVal = AddList(((AstNode)yyVals[-1+yyTop]), ((AstNode)yyVals[0+yyTop])); }
  break;
case 452:
  case_452();
  break;
case 453:
#line 1484 "Parser.y"
  {
                    yyVal = new EventDefinition(((MemberFlags)yyVals[-4+yyTop]), ((Expression)yyVals[-2+yyTop]), (string)((TokenValue)yyVals[-1+yyTop]).GetValue(), null, ((TokenPosition)yyVals[-3+yyTop]));
                  }
  break;
case 454:
#line 1487 "Parser.y"
  { yyVal = new EventAccessorDefinition(((MemberFlags)yyVals[-2+yyTop]), (string)((TokenValue)yyVals[-1+yyTop]).GetValue(), null, ((TokenValue)yyVals[-1+yyTop]));}
  break;
case 455:
#line 1490 "Parser.y"
  { yyVal = ((AstNode)yyVals[0+yyTop]); }
  break;
case 456:
#line 1491 "Parser.y"
  { yyVal = AddList(((AstNode)yyVals[-1+yyTop]), ((AstNode)yyVals[0+yyTop])); }
  break;
case 457:
  case_457();
  break;
case 458:
#line 1504 "Parser.y"
  {
                    yyVal = new EventDefinition(MemberFlags.InterfaceMember, ((Expression)yyVals[-2+yyTop]), (string)((TokenValue)yyVals[-1+yyTop]).GetValue(), null, ((TokenPosition)yyVals[-3+yyTop]));
                  }
  break;
case 459:
#line 1507 "Parser.y"
  { yyVal = ((AstNode)yyVals[-1+yyTop]); }
  break;
case 460:
#line 1508 "Parser.y"
  { yyVal = ((AstNode)yyVals[0+yyTop]); }
  break;
case 461:
#line 1509 "Parser.y"
  { yyVal = ((AstNode)yyVals[0+yyTop]); }
  break;
case 462:
#line 1510 "Parser.y"
  { yyVal = ((AstNode)yyVals[0+yyTop]); }
  break;
case 463:
#line 1511 "Parser.y"
  { yyVal = ((AstNode)yyVals[0+yyTop]); }
  break;
case 464:
#line 1512 "Parser.y"
  { yyVal = ((AstNode)yyVals[0+yyTop]); }
  break;
case 465:
#line 1513 "Parser.y"
  { yyVal = ((AstNode)yyVals[0+yyTop]); }
  break;
case 466:
#line 1514 "Parser.y"
  { yyVal = ((AstNode)yyVals[0+yyTop]); }
  break;
case 467:
#line 1515 "Parser.y"
  { yyVal = ((AstNode)yyVals[0+yyTop]); }
  break;
case 468:
#line 1516 "Parser.y"
  { yyVal = ((AstNode)yyVals[0+yyTop]); }
  break;
case 469:
#line 1517 "Parser.y"
  { yyVal = ((AstNode)yyVals[0+yyTop]); }
  break;
case 470:
#line 1518 "Parser.y"
  { yyVal = null; }
  break;
case 471:
#line 1521 "Parser.y"
  { ((AstNode)yyVals[0+yyTop]).SetAttributes(((AstNode)yyVals[-2+yyTop])); yyVal = ((AstNode)yyVals[0+yyTop]);}
  break;
case 472:
#line 1522 "Parser.y"
  { yyVal = ((AstNode)yyVals[0+yyTop]); }
  break;
case 473:
#line 1525 "Parser.y"
  { yyVal = null;			}
  break;
case 474:
#line 1526 "Parser.y"
  { yyVal = AddList(((AstNode)yyVals[-1+yyTop]), ((AstNode)yyVals[0+yyTop])); }
  break;
case 475:
#line 1529 "Parser.y"
  { yyVal = ((AstNode)yyVals[0+yyTop]); }
  break;
case 476:
#line 1530 "Parser.y"
  { yyVal = ((AstNode)yyVals[0+yyTop]); }
  break;
case 477:
#line 1531 "Parser.y"
  { yyVal = ((AstNode)yyVals[0+yyTop]); }
  break;
case 478:
#line 1534 "Parser.y"
  { yyVal = null; }
  break;
case 479:
#line 1535 "Parser.y"
  { yyVal = AddList(((AstNode)yyVals[-1+yyTop]), ((AstNode)yyVals[0+yyTop])); }
  break;
case 480:
#line 1538 "Parser.y"
  { yyVal = ((Expression)yyVals[0+yyTop]);				}
  break;
case 481:
#line 1539 "Parser.y"
  { yyVal = AddList(((AstNode)yyVals[-2+yyTop]), ((Expression)yyVals[0+yyTop])); }
  break;
case 482:
#line 1542 "Parser.y"
  { yyVal = null; }
  break;
case 483:
#line 1543 "Parser.y"
  { yyVal = ((AstNode)yyVals[0+yyTop]);	 }
  break;
case 484:
  case_484();
  break;
case 485:
  case_485();
  break;
case 486:
  case_486();
  break;
case 487:
  case_487();
  break;
case 488:
#line 1584 "Parser.y"
  { yyVal = new EnumConstantDefinition((string)((TokenValue)yyVals[0+yyTop]).GetValue(), null, ((TokenValue)yyVals[0+yyTop])); }
  break;
case 489:
#line 1585 "Parser.y"
  { yyVal = new EnumConstantDefinition((string)((TokenValue)yyVals[-2+yyTop]).GetValue(), ((Expression)yyVals[0+yyTop]), ((TokenValue)yyVals[-2+yyTop]));   }
  break;
case 490:
#line 1588 "Parser.y"
  { yyVal = null; }
  break;
case 491:
#line 1589 "Parser.y"
  { yyVal = ((AstNode)yyVals[0+yyTop]); }
  break;
case 492:
#line 1590 "Parser.y"
  { yyVal = AddList(((AstNode)yyVals[-2+yyTop]), ((AstNode)yyVals[0+yyTop])); }
  break;
case 493:
#line 1591 "Parser.y"
  { yyVal = ((AstNode)yyVals[-1+yyTop]); }
  break;
case 494:
#line 1594 "Parser.y"
  { yyVal = null; }
  break;
case 495:
#line 1595 "Parser.y"
  { yyVal = ((Expression)yyVals[0+yyTop]); }
  break;
case 496:
#line 1601 "Parser.y"
  {
                    yyVal = new EnumDefinition(((MemberFlags)yyVals[-6+yyTop]), (string)((TokenValue)yyVals[-4+yyTop]).GetValue(), ((AstNode)yyVals[-1+yyTop]), ((Expression)yyVals[-3+yyTop]), ((TokenPosition)yyVals[-5+yyTop]));
               }
  break;
case 497:
  case_497();
  break;
case 498:
#line 1613 "Parser.y"
  { yyVal = new FieldDeclaration((string)((TokenValue)yyVals[-2+yyTop]).GetValue(), ((Expression)yyVals[0+yyTop]), ((TokenValue)yyVals[-2+yyTop])); }
  break;
case 499:
#line 1614 "Parser.y"
  { yyVal = new FieldDeclaration((string)((TokenValue)yyVals[0+yyTop]).GetValue(), null, ((TokenValue)yyVals[0+yyTop])); }
  break;
case 500:
#line 1617 "Parser.y"
  { yyVal = ((AstNode)yyVals[0+yyTop]); }
  break;
case 501:
#line 1618 "Parser.y"
  { yyVal = AddList(((AstNode)yyVals[-2+yyTop]), ((AstNode)yyVals[0+yyTop])); }
  break;
case 502:
#line 1621 "Parser.y"
  { yyVal = new TypedefDefinition(((MemberFlags)yyVals[-4+yyTop]), ((Expression)yyVals[-2+yyTop]), (string)((TokenValue)yyVals[-1+yyTop]).GetValue(), ((TokenPosition)yyVals[-3+yyTop])); }
  break;
case 503:
#line 1624 "Parser.y"
  { yyVal = new UsingStatement(((Expression)yyVals[-1+yyTop]), ((TokenPosition)yyVals[-2+yyTop])); }
  break;
case 504:
#line 1625 "Parser.y"
  { yyVal = new AliasDeclaration((string)((TokenValue)yyVals[-3+yyTop]).GetValue(), ((Expression)yyVals[-1+yyTop]), ((TokenPosition)yyVals[-4+yyTop])); }
  break;
case 505:
#line 1629 "Parser.y"
  { yyVal = ((AstNode)yyVals[0+yyTop]); }
  break;
case 506:
#line 1630 "Parser.y"
  { yyVal = ((AstNode)yyVals[-1+yyTop]); }
  break;
case 507:
#line 1631 "Parser.y"
  { yyVal = ((AstNode)yyVals[0+yyTop]); }
  break;
case 508:
#line 1632 "Parser.y"
  { yyVal = ((AstNode)yyVals[0+yyTop]); }
  break;
case 509:
#line 1633 "Parser.y"
  { yyVal = ((AstNode)yyVals[0+yyTop]); }
  break;
case 510:
#line 1634 "Parser.y"
  { yyVal = ((AstNode)yyVals[0+yyTop]); }
  break;
case 511:
#line 1635 "Parser.y"
  { yyVal = ((AstNode)yyVals[0+yyTop]); }
  break;
case 512:
#line 1636 "Parser.y"
  { yyVal = ((AstNode)yyVals[0+yyTop]); }
  break;
case 513:
#line 1637 "Parser.y"
  { yyVal = ((AstNode)yyVals[0+yyTop]); }
  break;
case 514:
#line 1638 "Parser.y"
  { yyVal = ((AstNode)yyVals[0+yyTop]); }
  break;
case 515:
#line 1639 "Parser.y"
  { yyVal = ((AstNode)yyVals[0+yyTop]); }
  break;
case 516:
#line 1640 "Parser.y"
  { yyVal = ((AstNode)yyVals[0+yyTop]); }
  break;
case 517:
#line 1641 "Parser.y"
  { yyVal = null; }
  break;
case 518:
#line 1644 "Parser.y"
  { ((AstNode)yyVals[0+yyTop]).SetAttributes(((AstNode)yyVals[-2+yyTop])); yyVal = ((AstNode)yyVals[0+yyTop]); }
  break;
case 519:
#line 1645 "Parser.y"
  { yyVal = ((AstNode)yyVals[0+yyTop]); }
  break;
case 520:
#line 1648 "Parser.y"
  { yyVal = null; }
  break;
case 521:
#line 1649 "Parser.y"
  { yyVal = AddList(((AstNode)yyVals[-1+yyTop]), ((AstNode)yyVals[0+yyTop])); }
  break;
case 522:
#line 1652 "Parser.y"
  { yyVal = (string)((TokenValue)yyVals[0+yyTop]).GetValue(); }
  break;
case 523:
#line 1653 "Parser.y"
  { yyVal = ((string)yyVals[-2+yyTop]) + "." + (string)((TokenValue)yyVals[0+yyTop]).GetValue(); }
  break;
case 524:
#line 1656 "Parser.y"
  {yyVal = new NamespaceDefinition(((string)yyVals[-3+yyTop]), ((AstNode)yyVals[-1+yyTop]), ((TokenPosition)yyVals[-4+yyTop])); }
  break;
case 525:
#line 1659 "Parser.y"
  { yyVal = null;}
  break;
case 526:
#line 1660 "Parser.y"
  { yyVal = AddList(((AstNode)yyVals[-1+yyTop]), ((AstNode)yyVals[0+yyTop])); }
  break;
case 527:
#line 1663 "Parser.y"
  { yyVal = ((AstNode)yyVals[-1+yyTop]); }
  break;
#line default
        }
        yyTop -= yyLen[yyN];
        yyState = yyStates[yyTop];
        int yyM = yyLhs[yyN];
        if (yyState == 0 && yyM == 0) {
//t          if (debug != null) debug.shift(0, yyFinal);
          yyState = yyFinal;
          if (yyToken < 0) {
            yyToken = yyLex.advance() ? yyLex.token() : 0;
//t            if (debug != null)
//t               debug.lex(yyState, yyToken,yyname(yyToken), yyLex.value());
          }
          if (yyToken == 0) {
//t            if (debug != null) debug.accept(yyVal);
            return yyVal;
          }
          goto continue_yyLoop;
        }
        if (((yyN = yyGindex[yyM]) != 0) && ((yyN += yyState) >= 0)
            && (yyN < yyTable.Length) && (yyCheck[yyN] == yyState))
          yyState = yyTable[yyN];
        else
          yyState = yyDgoto[yyM];
//t        if (debug != null) debug.shift(yyStates[yyTop], yyState);
	 goto continue_yyLoop;
      continue_yyDiscarded: ;	// implements the named-loop continue: 'continue yyDiscarded'
      }
    continue_yyLoop: ;		// implements the named-loop continue: 'continue yyLoop'
    }
  }
コード例 #7
0
        public override AstNode Visit(EnumDefinition node)
        {
            // Push the scope.
            PushScope(node.GetScope());

            // Use a default type of const int.
            IChelaType baseType = ChelaType.GetIntType();
            IChelaType enumType = ConstantType.Create(baseType);

            // Declare the value field.
            Structure building = node.GetStructure();
            FieldVariable valueField =
                new FieldVariable("m_value", MemberFlags.Public, baseType, building);
            building.AddField(valueField);

            // Used for implicit prev + 1.
            IChelaType enumConst = ConstantType.Create(building);
            TypeNode enumIntExpr = new TypeNode(TypeKind.Other, node.GetPosition());
            enumIntExpr.SetOtherType(enumType);

            // Visit the constant defininitions.
            EnumConstantDefinition prev = null;
            AstNode child = node.GetChildren();
            while(child != null)
            {
                // Cast the child.
                EnumConstantDefinition constDef = (EnumConstantDefinition)child;

                // Set the child type.
                constDef.SetCoercionType(enumType);
                constDef.SetNodeType(enumConst);

                // If there isn't a constant expression, use previous + 1 or 0.
                if(constDef.GetValue() == null)
                {
                    TokenPosition constPos = constDef.GetPosition();
                    if(prev != null)
                    {
                        // Previous + 1
                        Expression prevExpr = new CastOperation(enumIntExpr,
                                                                new VariableReference(prev.GetName(), constPos),
                                                                constPos);
                        Expression implicitVal = new BinaryOperation(BinaryOperation.OpAdd,
                                                                     prevExpr,
                                                                     new ByteConstant(1, constPos),
                                                                     constPos);
                        constDef.SetValue(implicitVal);
                    }
                    else
                    {
                        // First element is 0
                        constDef.SetValue(new ByteConstant(0, constPos));
                    }
                }

                // Visit the constant definition.
                constDef.Accept(this);

                // Process the next constant.
                prev = constDef;
                child = child.GetNext();
            }

            // Restore the scope.
            PopScope();

            return node;
        }
コード例 #8
0
ファイル: FunctionSemantic.cs プロジェクト: ronsaldo/chela
        public override AstNode Visit(BinaryOperation node)
        {
            // Get the expressions.
            Expression left = node.GetLeftExpression();
            Expression right = node.GetRightExpression();

            // Make sure they are linked, used by operator overloading.
            if(left.GetNext() != null || right.GetNext() != null)
                Error(node, "binary operation arguments linked.");
            left.SetNext(right);

            // Visit the expressions.
            left.Accept(this);
            right.Accept(this);

            // Check the types.
            IChelaType leftType = left.GetNodeType();
            IChelaType rightType = right.GetNodeType();
            IChelaType nullRef = ChelaType.GetNullType();

            // Dereference and de-const types.
            bool leftConstant = leftType.IsConstant();
            leftType = DeConstType(leftType); // Required for string constant.
            if(leftType != nullRef && leftType.IsReference())
            {
                leftType = DeReferenceType(leftType);
                leftConstant = leftConstant || leftType.IsConstant();
                leftType = DeConstType(leftType);
                leftType = DeReferenceType(leftType);
            }

            leftConstant = leftConstant || leftType.IsConstant();
            leftType = DeConstType(leftType);

            // De-reference and de-const the right type.
            bool rightConstant = rightType.IsConstant();
            rightType = DeConstType(rightType);
            if(rightType != nullRef && rightType.IsReference())
            {
                rightType = DeReferenceType(rightType);
                rightConstant = rightConstant || rightType.IsConstant();
                rightType = DeConstType(rightType);
                rightType = DeReferenceType(rightType);
            }
            rightType = DeConstType(rightType);

            // Is this a constant.
            bool isConstant = leftConstant && rightConstant;

            // Copy the deref and deconst types.
            IChelaType actualLeftType = leftType;
            IChelaType actualRightType = rightType;

            // Check for operator overloading.
            string opName = BinaryOperation.GetOpName(node.GetOperation());
            Function overload = null;
            if((leftType.IsStructure() || leftType.IsClass()) &&
               opName != null)
            {
                // Find the operation function.
                Structure building = (Structure)leftType;
                FunctionGroup opGroup = (FunctionGroup)building.FindMember(opName);
                if(opGroup != null)
                {
                    // Pick the function from the group.
                    overload = PickFunction(node, opGroup, true, null, left, true);
                }
            }

            // Now check at the right type.
            if((rightType.IsStructure() || rightType.IsClass()) &&
               opName != null && overload == null)
            {
                // Find the operation function.
                Structure building = (Structure)rightType;
                FunctionGroup opGroup = (FunctionGroup)building.FindMember(opName);
                if(opGroup  != null)
                {
                    // Pick the function from the group.
                    overload = PickFunction(node, opGroup, true, null, left, true);
                }
            }

            // Use the found overload.
            if(overload != null)
            {
                // Set the operator overload.
                FunctionType overloadType = overload.GetFunctionType();
                node.SetNodeType(overloadType.GetReturnType());
                node.SetOverload(overload);
                return node;
            }

            // Check for pointer arithmetic.
            int op = node.GetOperation();
            if((leftType.IsPointer() || rightType.IsPointer()) &&
               (op == BinaryOperation.OpAdd || op == BinaryOperation.OpSub))
            {
                // Only addition and subtraction are accepted.
                if(leftType.IsPointer() && rightType.IsPointer())
                {
                    if(op == BinaryOperation.OpAdd)
                        Error(node, "cannot add two pointers.");

                    // Set the coercion type and pointer arithmetic flags.
                    node.SetNodeType(ChelaType.GetLongType());
                    node.SetCoercionType(leftType);
                    node.SetSecondCoercion(rightType);
                    node.SetPointerArithmetic(true);
                }
                else
                {
                    // Check type compatibility.
                    if(op == BinaryOperation.OpSub && !leftType.IsPointer())
                        Error(node, "cannot perform integer - pointer subtraction.");
                    else if((leftType.IsPointer() && !rightType.IsInteger()) ||
                            (!leftType.IsInteger() && rightType.IsPointer()))
                        Error(node, "only pointers and integers can be used in pointer arithmetic.");

                    // Set the coercion type and pointer arithmetic flags.
                    node.SetNodeType(leftType.IsPointer() ? leftType : rightType);
                    node.SetCoercionType(leftType);
                    node.SetSecondCoercion(rightType);
                    node.SetPointerArithmetic(true);
                }

                // There aren't intermediate operations.
                node.SetOperationType(node.GetNodeType());

                return node;
            }
            else
            {
                // Read the types again.
                leftType = left.GetNodeType();
                rightType = right.GetNodeType();
            }

            // Perform coercion.
            IChelaType destType = Coerce(node, leftType, rightType, right.GetNodeValue());
            if(destType == null)
                destType = Coerce(node, rightType, leftType, left.GetNodeValue());

            // Set the node coercion type.
            node.SetCoercionType(destType);
            node.SetSecondCoercion(destType);

            // Checks for matrix multiplication.
            if(BinaryOperation.OpMul == op)
            {
                // Use the actual types.
                leftType = actualLeftType;
                rightType = actualRightType;

                if(leftType.IsMatrix() && rightType.IsMatrix())
                {
                    // Cast the matrix.
                    MatrixType leftMatrix = (MatrixType)leftType;
                    MatrixType rightMatrix = (MatrixType)rightType;

                    // The number of first matrix columns must be equal
                    // to the number of the second matrix rows.
                    if(leftMatrix.GetNumColumns() != rightMatrix.GetNumRows())
                        Error(node, "not matching number of matrix column and rows");

                    // Coerce the primitive types.
                    IChelaType primCoercion = Coerce(leftMatrix.GetPrimitiveType(), rightMatrix.GetPrimitiveType());
                    if(primCoercion == null)
                        Error(node, "cannot multiply a {0} by a{1}", leftMatrix.GetDisplayName(), rightMatrix.GetDisplayName());
                    node.SetCoercionType(MatrixType.Create(primCoercion, leftMatrix.GetNumRows(), leftMatrix.GetNumColumns()));
                    node.SetSecondCoercion(MatrixType.Create(primCoercion, rightMatrix.GetNumRows(), rightMatrix.GetNumColumns()));

                    // Create the destination type.
                    destType = MatrixType.Create(primCoercion, leftMatrix.GetNumRows(), rightMatrix.GetNumColumns());
                    node.SetMatrixMul(true);
                }
                else if(leftType.IsMatrix() && rightType.IsVector())
                {
                    // Cast the matrix and the vector.
                    MatrixType leftMatrix = (MatrixType)leftType;
                    VectorType rightVector = (VectorType)rightType;

                    // Check the dimensions.
                    if(leftMatrix.GetNumColumns() != rightVector.GetNumComponents())
                        Error(node, "not matching number of matrix column and rows");

                    // Coerce the primitive types.
                    IChelaType primCoercion = Coerce(leftMatrix.GetPrimitiveType(), rightVector.GetPrimitiveType());
                    if(primCoercion == null)
                        Error(node, "cannot multiply a {0} by a {1}", leftMatrix.GetDisplayName(), rightVector.GetDisplayName());
                    node.SetCoercionType(MatrixType.Create(primCoercion, leftMatrix.GetNumRows(), leftMatrix.GetNumColumns()));
                    node.SetSecondCoercion(VectorType.Create(primCoercion, rightVector.GetNumComponents()));

                    // Create the destination type.
                    destType = VectorType.Create(primCoercion, leftMatrix.GetNumRows());
                    node.SetMatrixMul(true);
                }
                else if(rightType.IsMatrix() && leftType.IsVector())
                {
                    // Cast the matrix and the vector.
                    VectorType leftVector = (VectorType)leftType;
                    MatrixType rightMatrix = (MatrixType)rightType;

                    // Check the dimensions.
                    if(leftVector.GetNumComponents() != rightMatrix.GetNumRows())
                        Error(node, "not matching number of matrix column and rows");

                    // Coerce the primitive types.
                    IChelaType primCoercion = Coerce(leftVector.GetPrimitiveType(), rightMatrix.GetPrimitiveType());
                    if(primCoercion == null)
                        Error(node, "cannot multiply a {0} by a {1}", leftVector.GetDisplayName(), rightMatrix.GetDisplayName());
                    node.SetCoercionType(VectorType.Create(primCoercion, leftVector.GetNumComponents()));
                    node.SetSecondCoercion(MatrixType.Create(primCoercion, rightMatrix.GetNumRows(), rightMatrix.GetNumColumns()));

                    // Create the destination type.
                    destType = VectorType.Create(primCoercion, rightMatrix.GetNumColumns());
                    node.SetMatrixMul(true);
                }
            }

            // Check for special operations
            if(destType == null)
            {
                // Use the actual types.
                leftType = actualLeftType;
                rightType = actualRightType;

                // Check for external operations.
                if(leftType.IsVector() && (op == BinaryOperation.OpDiv
                   || op == BinaryOperation.OpMul))
                {
                    // Select the types.
                    VectorType vectorType = (VectorType)leftType;
                    IChelaType primitiveType = rightType;

                    // Coerce the primitive type.
                    IChelaType secondCoercion = vectorType.GetPrimitiveType();
                    if(primitiveType != secondCoercion &&
                       Coerce(secondCoercion, primitiveType) != secondCoercion)
                        Error(node, "failed to perform scalar operation.");

                    // Store the new coercion types.
                    destType = vectorType;
                    node.SetCoercionType(vectorType);
                    node.SetSecondCoercion(secondCoercion);
                }
                else if(rightType.IsVector() && op == BinaryOperation.OpMul)
                {
                    // Select the types.
                    IChelaType primitiveType = leftType;
                    VectorType vectorType = (VectorType)rightType;

                    // Coerce the primitive type.
                    IChelaType firstCoercion = vectorType.GetPrimitiveType();
                    if(primitiveType != firstCoercion &&
                       Coerce(firstCoercion, primitiveType) != firstCoercion)
                        Error(node, "failed to perform scalar operation.");

                    // Store the new coercion types.
                    destType = vectorType;
                    node.SetCoercionType(firstCoercion);
                    node.SetSecondCoercion(vectorType);
                }
                else
                    Error(node, "failed to perform binary operation, invalid operands of type {0} and {1}.",
                        leftType.GetDisplayName(), rightType.GetDisplayName());
            }

            // De-const the type.
            destType = DeConstType(destType);

            // Dest type must be integer, float or boolean.
            IChelaType operationType = destType;
            if(!destType.IsNumber() && !destType.IsPointer() &&
                !BinaryOperation.IsEquality(op))
            {
                // Try to operate with the unboxed types.
                // Only structures are box holders.
                if(!destType.IsStructure())
                    Error(node, "cannot perform binary operations with type {0}.", destType.GetDisplayName());

                // Use the structure associated type, or use his enum type.
                Structure building = (Structure)destType;
                IChelaType assocType = currentModule.GetAssociatedClassPrimitive(building);
                if(assocType == null)
                {
                    // The structure can be an enumeration.
                    Class enumClass = currentModule.GetEnumClass();
                    if(!building.IsDerivedFrom(enumClass))
                        Error(node, "cannot perform operation {0} with object of types {1}.",
                            BinaryOperation.GetOpErrorName(op),
                            building.GetDisplayName());
                }

                // Unbox the structure.
                FieldVariable valueField = building.FindMember("__value") as FieldVariable;
                if(valueField == null)
                    valueField = building.FindMember("m_value") as FieldVariable;
                if(valueField == null)
                    Error(node, "structure {0} is not boxing a primitive.", building.GetDisplayName());
                operationType = valueField.GetVariableType();
                node.SetCoercionType(operationType);
                node.SetSecondCoercion(operationType);
            }

            // Use integers of at least 4 bytes.
            if(!operationType.IsPlaceHolderType() && operationType.IsInteger() &&
                operationType.GetSize() < 4 && BinaryOperation.IsArithmetic(op))
            {
                destType = ChelaType.GetIntType();
                operationType = destType;
                IChelaType coercionType = destType;
                if(isConstant)
                    coercionType = ConstantType.Create(destType);
                node.SetCoercionType(coercionType);
                node.SetSecondCoercion(coercionType);
            }

            // Perform validation
            switch(op)
            {
            case BinaryOperation.OpAdd:
            case BinaryOperation.OpMul:
            case BinaryOperation.OpDiv:
            case BinaryOperation.OpMod:
                if(operationType == ChelaType.GetBoolType())
                    Error(node, "Arithmetic operations aren't available with boolean values.");
                break;

            case BinaryOperation.OpSub:
                if(operationType == ChelaType.GetBoolType())
                    Error(node, "Arithmetic operations aren't available with boolean values.");

                // Use signed integer when subtracting.
                if(operationType.IsInteger() && operationType.IsUnsigned())
                {
                    // Use a new dest type and coercion type.
                    IntegerType intType = (IntegerType)operationType;
                    operationType = intType.GetSignedVersion();

                    IChelaType newCoercion = destType;
                    if(isConstant)
                        newCoercion = ConstantType.Create(intType);

                    // Override the result types.
                    node.SetCoercionType(newCoercion);
                    node.SetSecondCoercion(newCoercion);
                    destType = operationType;
                }
                break;
            case BinaryOperation.OpBitAnd:
            case BinaryOperation.OpBitOr:
            case BinaryOperation.OpBitXor:
            case BinaryOperation.OpBitLeft:
            case BinaryOperation.OpBitRight:
                if(operationType.IsFloatingPoint() || operationType == ChelaType.GetBoolType())
                    Error(node, "Bitwise operations aren't available with floating point and boolean values.");
                break;
            case BinaryOperation.OpLT:
            case BinaryOperation.OpGT:
            case BinaryOperation.OpEQ:
            case BinaryOperation.OpNEQ:
            case BinaryOperation.OpLEQ:
            case BinaryOperation.OpGEQ:
                // Boolean result.
                operationType = ChelaType.GetBoolType();
                destType = operationType;
                break;
            case BinaryOperation.OpLAnd:
            case BinaryOperation.OpLOr:
                // Left and right must be boolean.
                if(operationType != ChelaType.GetBoolType())
                    Error(node, "Expected boolean arguments.");
                break;
            default:
                Error(node, "Compiler bug, unknown binary operation.");
                break;
            }

            // Set the destination type.
            if(isConstant)
            {
                node.SetOperationType(ConstantType.Create(operationType));
                node.SetNodeType(ConstantType.Create(destType));
            }
            else
            {
                node.SetOperationType(operationType);
                node.SetNodeType(destType);
            }

            return node;
        }
コード例 #9
0
ファイル: FunctionSemantic.cs プロジェクト: ronsaldo/chela
        public override AstNode Visit(UsingObjectStatement node)
        {
            // Create the using lexical scope.
            LexicalScope blockScope = CreateLexicalScope(node);
            node.SetScope(blockScope);

            // Push the scope.
            PushScope(blockScope);

            // Get the local declarations.
            LocalVariablesDeclaration decls = node.GetLocals();
            decls.Accept(this);

            // Check if disposing or deleting.
            IChelaType varType = decls.GetNodeType();
            bool pointer = varType.IsPointer();
            if(!pointer)
            {
                // Make sure it could implement IDisposable.
                varType = DeReferenceType(varType);
                if(!varType.IsStructure() && !varType.IsClass() && !varType.IsReference())
                    Error(node, "cannot dispose object that isn't a structure, class or interface.");

                // Make sure it does implement IDisposable.
                Structure building = (Structure) varType;
                Structure idisposable = currentModule.GetLangMember("IDisposable") as Interface;
                if(idisposable == null)
                    Error(node, "couldn't find IDisposable");
                if(building != idisposable && !building.Implements(idisposable))
                    Error(node, "object doesn't implement IDisposable.");
            }

            // Build the finally clause.
            TokenPosition position = node.GetPosition();
            AstNode finallyChildren = null;
            AstNode lastChild = null;
            AstNode decl = decls.GetDeclarations();
            while(decl != null)
            {
                AstNode disposeStmnt = null;
                if(pointer)
                {
                    // Delete the variable
                    Expression variable = new VariableReference(decl.GetName(), position);
                    disposeStmnt = new DeleteStatement(variable, position);
                }
                else
                {
                    // Call the variable dispose.
                    Expression functionExpr = new MemberAccess(new VariableReference(decl.GetName(), position), "Dispose", position);
                    Expression callExpr = new CallExpression(functionExpr, null, position);
                    disposeStmnt = new ExpressionStatement(callExpr, position);
                }

                // If not null.
                Expression notNull = new BinaryOperation(BinaryOperation.OpNEQ, new VariableReference(decl.GetName(), position), new NullConstant(position), position);
                IfStatement ifStmnt = new IfStatement(notNull, disposeStmnt, null, position);

                // Link the call.
                if(lastChild == null)
                {
                    finallyChildren = lastChild = ifStmnt;
                }
                else
                {
                    lastChild.SetNext(ifStmnt);
                    lastChild = ifStmnt;
                }

                // Dispose the next declaration.
                decl = decl.GetNext();
            }

            // Build the try-finally.
            FinallyStatement finallyClause = new FinallyStatement(finallyChildren, position);
            TryStatement tryStatement = new TryStatement(node.GetChildren(), null, finallyClause, position);

            // Substitute the children with the try.
            node.SetChildren(tryStatement);

            // Visit the block  children.
            VisitList(node.GetChildren());

            // Restore the scope.
            PopScope();

            return node;
        }