public override void OutABinopExp(ABinopExp node)
        {
            PBinop binop = node.GetBinop();
            PExp left = node.GetLeft();
            PType leftType = data.ExpTypes[left];
            string leftTypeString = Util.TypeToString(leftType);
            PExp right = node.GetRight();
            PType rightType = data.ExpTypes[right];
            string rightTypeString = Util.TypeToString(rightType);

            bool wasDefined = false;
            Token token = null;
            while (true)
            {
                if (binop is APlusBinop)
                {
                    token = ((APlusBinop) binop).GetToken();
                    //Check that types are okay for +
                    if (!new[] {"int", "fixed", "string", "text", "byte", "point"}.Any(c => c == leftTypeString))
                    {
                        errors.Add(new ErrorCollection.Error(token, currentSourceFile,
                                                             LocRM.GetString("ErrorText103") + leftTypeString));
                        throw new ParserException(null, null);
                    }
                    if (!new[] {"int", "fixed", "string", "text", "byte", "point"}.Any(c => c == rightTypeString))
                    {
                        errors.Add(new ErrorCollection.Error(token, currentSourceFile,
                                                             LocRM.GetString("ErrorText103") + rightTypeString));
                        throw new ParserException(null, null);
                    }
                    //If you are using string or text, both sides must be same type
                    if ((leftTypeString == "string" && rightTypeString != "string") ||
                        (leftTypeString == "text" && rightTypeString != "text") ||
                        (leftTypeString == "point" && rightTypeString != "point") ||
                        (rightTypeString == "string" && leftTypeString != "string") ||
                        (rightTypeString == "text" && leftTypeString != "text") ||
                        (rightTypeString == "point" && leftTypeString != "point"))
                    {
                        if (ImplicitAssignable(leftType, rightType))
                        {
                            ANamedType namedTo = (ANamedType) rightType;
                            ACastExp cast = new ACastExp(new TLParen("("),
                                                         new ANamedType(
                                                             new TIdentifier(((AAName) namedTo.GetName()).AsString()),
                                                             null), node.GetLeft());
                            node.SetLeft(cast);
                            OutACastExp(cast);
                            leftType = rightType;
                        }
                        else if (ImplicitAssignable(rightType, leftType))
                        {
                            ANamedType namedTo = (ANamedType) leftType;
                            ACastExp cast = new ACastExp(new TLParen("("),
                                                         new ANamedType(
                                                             new TIdentifier(((AAName) namedTo.GetName()).AsString()),
                                                             null), node.GetRight());
                            node.SetRight(cast);
                            OutACastExp(cast);
                            rightType = leftType;
                        }
                        else
                        {
                            //Not valid
                            break;
                        }
                    }
                    wasDefined = true;
                    PType type = leftType;
                    if (rightTypeString == "fixed")
                        type = rightType;
                    data.ExpTypes[node] = type;
                }
                else if (binop is AMinusBinop || binop is ATimesBinop || binop is ADivideBinop || binop is AModuloBinop)
                {
                    token = null;
                    if (binop is AMinusBinop) token = ((AMinusBinop) binop).GetToken();
                    else if (binop is ATimesBinop) token = ((ATimesBinop) binop).GetToken();
                    else if (binop is ADivideBinop) token = ((ADivideBinop) binop).GetToken();
                    else if (binop is AModuloBinop) token = ((AModuloBinop) binop).GetToken();

                    //Check that types are okay for whatever
                    if (!new[] {"int", "fixed", "byte", "point"}.Any(c => c == leftTypeString))
                    {
                        //Not valid
                        break;
                    }
                    if (!new[] {"int", "fixed", "byte", "point"}.Any(c => c == rightTypeString))
                    {
                        //Not valid
                        break;
                    }
                    if ((leftTypeString == "point" || rightTypeString == "point") &&
                        !(leftTypeString == "point" && rightTypeString == "point" && binop is AMinusBinop))
                    {
                        //Not valid
                        break;
                    }
                    wasDefined = true;
                    PType type = leftType;
                    if (rightTypeString == "fixed")
                        type = rightType;
                    if (rightTypeString == "int" && leftTypeString == "byte")
                        type = rightType;
                    data.ExpTypes[node] = type;
                }
                else if (binop is AEqBinop || binop is ANeBinop || binop is ALtBinop || binop is ALeBinop ||
                         binop is AGtBinop || binop is AGeBinop)
                {
                    token = null;
                    if (binop is AEqBinop) token = ((AEqBinop) binop).GetToken();
                    else if (binop is ANeBinop) token = ((ANeBinop) binop).GetToken();
                    else if (binop is ALtBinop) token = ((ALtBinop) binop).GetToken();
                    else if (binop is ALeBinop) token = ((ALeBinop) binop).GetToken();
                    else if (binop is AGtBinop) token = ((AGtBinop) binop).GetToken();
                    else if (binop is AGeBinop) token = ((AGeBinop) binop).GetToken();

                    //Unless types are int and fixed, they must be the same type, or null and a nullable type
                    if (leftTypeString == "void" || rightTypeString == "void" ||
                        !(
                             GalaxyKeywords.NullablePrimitives.words.Any(s => s == leftTypeString) &&
                             rightTypeString == "null" ||
                             leftTypeString == "null" &&
                             GalaxyKeywords.NullablePrimitives.words.Any(s => s == rightTypeString) ||
                             (leftTypeString == "int" || leftTypeString == "fixed" || leftTypeString == "byte") &&
                             (rightTypeString == "int" || rightTypeString == "fixed" || rightTypeString == "byte") ||
                             leftTypeString == rightTypeString && !(IsDynamic(leftType) || IsDynamic(rightType)) ||
                             (binop is AEqBinop || binop is ANeBinop) &&
                             (
                                 leftTypeString == rightTypeString ||
                                 leftTypeString == "null" && IsDynamic(rightType) ||
                                 IsDynamic(leftType) && rightTypeString == "null" ||
                                 Util.TypesEqual(leftType, rightType, data)
                             ) ||
                             leftType is ANamedType && data.DelegateTypeLinks.ContainsKey((ANamedType) leftType) &&
                             (rightTypeString == "null" ||
                              rightType is ANamedType && data.DelegateTypeLinks.ContainsKey((ANamedType) rightType)) ||
                             rightType is ANamedType && data.DelegateTypeLinks.ContainsKey((ANamedType) rightType) &&
                             leftTypeString == "null"
                         )
                        )
                    {

                        //Not valid
                        break;

                    }
                    wasDefined = true;
                    data.ExpTypes[node] = new ANamedType(new TIdentifier("bool"), null);
                }
                else if (binop is AAndBinop || binop is AOrBinop || binop is AXorBinop || binop is ALBitShiftBinop ||
                         binop is ARBitShiftBinop)
                {
                    token = null;
                    if (binop is AAndBinop) token = ((AAndBinop) binop).GetToken();
                    else if (binop is AOrBinop) token = ((AOrBinop) binop).GetToken();
                    else if (binop is AXorBinop) token = ((AXorBinop) binop).GetToken();
                    else if (binop is ALBitShiftBinop) token = ((ALBitShiftBinop) binop).GetToken();
                    else if (binop is ARBitShiftBinop) token = ((ARBitShiftBinop) binop).GetToken();

                    if (
                        !((leftTypeString == "int" || leftTypeString == "byte") &&
                          (rightTypeString == "int" || rightTypeString == "byte") &&
                          (binop is ALBitShiftBinop || binop is ARBitShiftBinop ||
                           leftTypeString == rightTypeString)))
                    {
                        if (rightTypeString == "int" && leftTypeString == "byte" && left is AIntConstExp)
                        {
                            data.ExpTypes[left] =
                                leftType = new ANamedType(new TIdentifier("int"), null);
                            leftTypeString = "int";
                        }
                        else if (leftTypeString == "int" && rightTypeString == "byte" && right is AIntConstExp)
                        {
                            data.ExpTypes[right] =
                                rightType = new ANamedType(new TIdentifier("int"), null);
                            rightTypeString = "int";
                        }
                        else
                        {
                            //Not valid
                            break;
                        }
                    }
                    wasDefined = true;
                    data.ExpTypes[node] = leftType;
                    if (rightTypeString == "int")
                        data.ExpTypes[node] = rightType;
                }
                else if (binop is ALazyAndBinop || binop is ALazyOrBinop)
                {
                    token = null;
                    if (binop is ALazyAndBinop) token = ((ALazyAndBinop) binop).GetToken();
                    else if (binop is ALazyOrBinop) token = ((ALazyOrBinop) binop).GetToken();

                    if (leftTypeString != "bool" || rightTypeString != "bool")
                    {

                        errors.Add(new ErrorCollection.Error(token, currentSourceFile,
                                                             token.Text + LocRM.GetString("ErrorText104") +
                                                             token.Text +
                                                             " bool). Got (" +
                                                             leftTypeString + " " + token.Text + " " +
                                                             rightTypeString + ")"));
                        throw new ParserException(null, null);
                    }
                    wasDefined = true;
                    data.ExpTypes[node] = leftType;
                }
                else
                    throw new Exception("Unexpected binop (This should never happen)");
                break;
            }

            List<AMethodDecl> possibleOperators = new List<AMethodDecl>();
            List<IList> visibleDecls = Util.GetVisibleDecls(node, true);
            List<string> currentNamespace = Util.GetFullNamespace(node);
            AASourceFile currentFile = Util.GetAncestor<AASourceFile>(node);
            foreach (IList declList in visibleDecls)
            {
                bool sameNS = false;
                bool sameFile = false;
                if (declList.Count > 0)
                {
                    sameNS = Util.NamespacesEquals(currentNamespace, Util.GetFullNamespace((PDecl) declList[0]));
                    sameFile = currentFile == Util.GetAncestor<AASourceFile>((PDecl) declList[0]);
                }
                foreach (PDecl decl in declList)
                {
                    if (decl is AMethodDecl)
                    {
                        AMethodDecl method = (AMethodDecl) decl;
                        if (method.GetName().Text == token.Text)
                        {
                            if (method.GetVisibilityModifier() is APrivateVisibilityModifier && !sameNS)
                                continue;
                            if (method.GetStatic() != null && !sameFile)
                                continue;
                            //Check that parameters are assignable
                            bool add = true;
                            bool matchImplicit = false;
                            List<PType> argTypes = new List<PType>(){leftType, rightType};
                            for (int i = 0; i < argTypes.Count; i++)
                            {
                                PType argType = argTypes[i];
                                AALocalDecl formal = (AALocalDecl)method.GetFormals()[i];
                                PType formalType = formal.GetType();
                                if (formal.GetOut() != null && !Assignable(formalType, argType)
                                    ||
                                    formal.GetRef() != null &&
                                    !(Assignable(argType, formalType) && Assignable(formalType, argType))
                                    ||
                                    formal.GetOut() == null && formal.GetRef() == null &&
                                    !Assignable(argType, formalType))
                                {
                                    add = false;
                                    if (formal.GetOut() == null && formal.GetRef() == null &&
                                        ImplicitAssignable(argType, formalType))
                                    {
                                        matchImplicit = true;
                                    }
                                    else
                                    {
                                        matchImplicit = false;
                                        break;
                                    }
                                }
                            }
                            if (!add && !matchImplicit)
                                continue;
                            if (add)
                                possibleOperators.Add(method);
                        }
                    }
                }
            }

            if (possibleOperators.Count == 0 && !wasDefined)
            {
                errors.Add(new ErrorCollection.Error(token, LocRM.GetString("ErrorText105") + leftTypeString + " " + token.Text + " " + rightTypeString + ")"));
                throw new ParserException(token, "TypeChecking.OutABinopExp");
            }

            if (possibleOperators.Count + (wasDefined ? 1 : 0) > 1)
            {
                List<ErrorCollection.Error> subErrors = new List<ErrorCollection.Error>();
                foreach (AMethodDecl method in possibleOperators)
                {
                    subErrors.Add(new ErrorCollection.Error(method.GetName(), LocRM.GetString("ErrorText106")));
                }
                if (wasDefined)
                    subErrors.Add(new ErrorCollection.Error(token, LocRM.GetString("ErrorText107") + token.Text));
                errors.Add(new ErrorCollection.Error(token, LocRM.GetString("ErrorText108") + leftTypeString + " " + token.Text + " " + rightTypeString + LocRM.GetString("ErrorText109"), false, subErrors.ToArray()));
                throw new ParserException(token, "TypeChecking.OutABinopExp");
            }

            if (wasDefined)
                return;

            AMethodDecl op = possibleOperators[0];
            ASimpleInvokeExp replacer = new ASimpleInvokeExp(new TIdentifier(op.GetName().Text), new ArrayList(){node.GetLeft(), node.GetRight()});
            node.ReplaceBy(replacer);
            data.SimpleMethodLinks[replacer] = op;
            data.ExpTypes[replacer] = op.GetReturnType();

            //base.OutABinopExp(node);
        }
            public static AMethodDecl CreateDeleteStructMethodGlobalArrayP(Node node, TIntegerLiteral intDim, string prefix, GlobalStructVars vars, SharedData data)
            {
                /*
                    void DeleteStr(int i)
                    {
                        if (!(Str_used[i / 31] & Power2(i % 31)))
                        {
                            return;
                        }
                        Str_used[i / 31] = Str_used[i / 31] - Power2(i % 31);
                        stack[freeCount] = i;
                        freeCount += 1;
                        /*if (i == Str_index)
                        {
                            while (!(Str_used[i / 31] & Power2(i % 31)))
                            {
                                i = i - 1;
                                if (i < 0)
                                {
                                    i = 41;
                                }
                                if (i == Str_index)
                                {
                                    //Everything is free
                                    break;
                                }
                            }
                            Str_index = i;
                        }* /
                    }
                 */

                AASourceFile file = Util.GetAncestor<AASourceFile>(node);

                AIntConstExp intConst1 = new AIntConstExp(new TIntegerLiteral("31"));
                AIntConstExp intConst2 = new AIntConstExp(new TIntegerLiteral("31"));
                AIntConstExp intConst3 = new AIntConstExp(new TIntegerLiteral("31"));
                AIntConstExp intConst4 = new AIntConstExp(new TIntegerLiteral("31"));
                AIntConstExp intConst5 = new AIntConstExp(new TIntegerLiteral("31"));
                AIntConstExp intConst6 = new AIntConstExp(new TIntegerLiteral("31"));
                AIntConstExp intConst7 = new AIntConstExp(new TIntegerLiteral("31"));
                AIntConstExp intConst8 = new AIntConstExp(new TIntegerLiteral("1"));
                AIntConstExp intConst9 = new AIntConstExp(new TIntegerLiteral("0"));
                AIntConstExp intConst10 = new AIntConstExp(new TIntegerLiteral((int.Parse(intDim.Text) - 1).ToString()));
                AIntConstExp intConst11 = new AIntConstExp(new TIntegerLiteral("1"));
                AIntConstExp intConst12 = new AIntConstExp(new TIntegerLiteral("1"));
                AIntConstExp intConst13 = new AIntConstExp(new TIntegerLiteral("1"));

                AFieldLvalue strUsedRef1 = new AFieldLvalue(new TIdentifier(vars.Used.GetName().Text));
                AFieldLvalue strUsedRef2 = new AFieldLvalue(new TIdentifier(vars.Used.GetName().Text));
                AFieldLvalue strUsedRef3 = new AFieldLvalue(new TIdentifier(vars.Used.GetName().Text));
                AFieldLvalue strUsedRef4 = new AFieldLvalue(new TIdentifier(vars.Used.GetName().Text));
                ALvalueExp strUsedRef1Exp = new ALvalueExp(strUsedRef1);
                ALvalueExp strUsedRef2Exp = new ALvalueExp(strUsedRef2);
                ALvalueExp strUsedRef3Exp = new ALvalueExp(strUsedRef3);
                ALvalueExp strUsedRef4Exp = new ALvalueExp(strUsedRef4);

                AFieldLvalue strIndexRef1 = new AFieldLvalue(new TIdentifier(vars.Index.GetName().Text));
                AFieldLvalue strIndexRef2 = new AFieldLvalue(new TIdentifier(vars.Index.GetName().Text));
                AFieldLvalue strIndexRef3 = new AFieldLvalue(new TIdentifier(vars.Index.GetName().Text));
                ALvalueExp strIndexRef1Exp = new ALvalueExp(strIndexRef1);
                ALvalueExp strIndexRef2Exp = new ALvalueExp(strIndexRef2);

                AALocalDecl iDecl = new AALocalDecl(new APublicVisibilityModifier(), null, null, null, null, new ANamedType(new TIdentifier("int"), null),
                                                    new TIdentifier("i"), null);
                ALocalLvalue iRef1 = new ALocalLvalue(new TIdentifier("i"));
                ALocalLvalue iRef2 = new ALocalLvalue(new TIdentifier("i"));
                ALocalLvalue iRef3 = new ALocalLvalue(new TIdentifier("i"));
                ALocalLvalue iRef4 = new ALocalLvalue(new TIdentifier("i"));
                ALocalLvalue iRef5 = new ALocalLvalue(new TIdentifier("i"));
                ALocalLvalue iRef6 = new ALocalLvalue(new TIdentifier("i"));
                ALocalLvalue iRef7 = new ALocalLvalue(new TIdentifier("i"));
                ALocalLvalue iRef8 = new ALocalLvalue(new TIdentifier("i"));
                ALocalLvalue iRef9 = new ALocalLvalue(new TIdentifier("i"));
                ALocalLvalue iRef10 = new ALocalLvalue(new TIdentifier("i"));
                ALocalLvalue iRef11 = new ALocalLvalue(new TIdentifier("i"));
                ALocalLvalue iRef12 = new ALocalLvalue(new TIdentifier("i"));
                ALocalLvalue iRef13 = new ALocalLvalue(new TIdentifier("i"));
                ALocalLvalue iRef14 = new ALocalLvalue(new TIdentifier("i"));
                ALvalueExp iRef1Exp = new ALvalueExp(iRef1);
                ALvalueExp iRef2Exp = new ALvalueExp(iRef2);
                ALvalueExp iRef3Exp = new ALvalueExp(iRef3);
                ALvalueExp iRef4Exp = new ALvalueExp(iRef4);
                ALvalueExp iRef5Exp = new ALvalueExp(iRef5);
                ALvalueExp iRef6Exp = new ALvalueExp(iRef6);
                ALvalueExp iRef7Exp = new ALvalueExp(iRef7);
                ALvalueExp iRef8Exp = new ALvalueExp(iRef8);
                ALvalueExp iRef10Exp = new ALvalueExp(iRef10);
                ALvalueExp iRef11Exp = new ALvalueExp(iRef11);
                ALvalueExp iRef13Exp = new ALvalueExp(iRef13);
                ALvalueExp iRef14Exp = new ALvalueExp(iRef14);

                ABinopExp binop1 = new ABinopExp(iRef1Exp, new ADivideBinop(new TDiv("/")), intConst1);
                ABinopExp binop2 = new ABinopExp(iRef2Exp, new AModuloBinop(new TMod("%")), intConst2);
                ABinopExp binop3 = new ABinopExp(null, new AAndBinop(new TAnd("&")), null);
                ABinopExp binop4 = new ABinopExp(iRef3Exp, new ADivideBinop(new TDiv("/")), intConst3);
                ABinopExp binop5 = new ABinopExp(iRef4Exp, new ADivideBinop(new TDiv("/")), intConst4);
                ABinopExp binop6 = new ABinopExp(iRef5Exp, new AModuloBinop(new TMod("%")), intConst5);
                ABinopExp binop7 = new ABinopExp(null, new AMinusBinop(new TMinus("-")), null);
                ABinopExp binop8 = new ABinopExp(iRef6Exp, new AEqBinop(new TEq("==")), strIndexRef1Exp);
                ABinopExp binop9 = new ABinopExp(iRef7Exp, new ADivideBinop(new TDiv("/")), intConst6);
                ABinopExp binop10 = new ABinopExp(iRef8Exp, new AModuloBinop(new TMod("%")), intConst7);
                ABinopExp binop11 = new ABinopExp(null, new AAndBinop(new TAnd("&")), null);
                ABinopExp binop12 = new ABinopExp(iRef10Exp, new AMinusBinop(new TMinus("-")), intConst8);
                ABinopExp binop13 = new ABinopExp(iRef11Exp, new ALtBinop(new TLt("<")), intConst9);
                ABinopExp binop14 = new ABinopExp(iRef13Exp, new AEqBinop(new TEq("==")), strIndexRef2Exp);

                AArrayLvalue arrayIndex1 = new AArrayLvalue(new TLBracket("["), strUsedRef1Exp, binop1);
                AArrayLvalue arrayIndex2 = new AArrayLvalue(new TLBracket("["), strUsedRef2Exp, binop4);
                AArrayLvalue arrayIndex3 = new AArrayLvalue(new TLBracket("["), strUsedRef3Exp, binop5);
                AArrayLvalue arrayIndex4 = new AArrayLvalue(new TLBracket("["), strUsedRef4Exp, binop9);
                ALvalueExp arrayIndex1Exp = new ALvalueExp(arrayIndex1);
                ALvalueExp arrayIndex3Exp = new ALvalueExp(arrayIndex3);
                ALvalueExp arrayIndex4Exp = new ALvalueExp(arrayIndex4);
                binop3.SetLeft(arrayIndex1Exp);
                binop7.SetLeft(arrayIndex3Exp);
                binop11.SetLeft(arrayIndex4Exp);

                ABinopExp binop15 = new ABinopExp(intConst11, new ALBitShiftBinop(new TLBitShift("<<")), binop2);
                ABinopExp binop16 = new ABinopExp(intConst12, new ALBitShiftBinop(new TLBitShift("<<")), binop6);
                ABinopExp binop17 = new ABinopExp(intConst13, new ALBitShiftBinop(new TLBitShift("<<")), binop10);
                binop3.SetRight(binop15);
                binop7.SetRight(binop16);
                binop11.SetRight(binop17);
                /*ASimpleInvokeExp power2Invoke1 = new ASimpleInvokeExp(new TIdentifier("Power2"), new ArrayList() { binop2 });
                ASimpleInvokeExp power2Invoke2 = new ASimpleInvokeExp(new TIdentifier("Power2"), new ArrayList() { binop6 });
                ASimpleInvokeExp power2Invoke3 = new ASimpleInvokeExp(new TIdentifier("Power2"), new ArrayList() { binop10 });
                binop3.SetRight(power2Invoke1);
                binop7.SetRight(power2Invoke2);
                binop11.SetRight(power2Invoke3);*/

                AParenExp paren1 = new AParenExp(binop3);
                AParenExp paren2 = new AParenExp(binop11);

                AUnopExp unop1 = new AUnopExp(new AComplementUnop(new TComplement("!")), paren1);
                AUnopExp unop2 = new AUnopExp(new AComplementUnop(new TComplement("!")), paren2);

                AAssignmentExp assignment1 = new AAssignmentExp(new TAssign("="), arrayIndex2, binop7);
                AAssignmentExp assignment2 = new AAssignmentExp(new TAssign("="), iRef9, binop12);
                AAssignmentExp assignment3 = new AAssignmentExp(new TAssign("="), iRef12, intConst10);
                AAssignmentExp assignment4 = new AAssignmentExp(new TAssign("="), strIndexRef3, iRef14Exp);

                AMethodDecl method = new AMethodDecl(new APublicVisibilityModifier(), null, null, null, null, null,
                                                                 new AVoidType(new TVoid("void")),
                                                                 new TIdentifier("Delete" + prefix, data.LineCounts[file] + 18, 0),
                                                                 new ArrayList() { iDecl },
                                                                 new AABlock(
                                                                     new ArrayList()
                                                                         {
                                                                             new AIfThenStm(new TLParen("("), unop1,
                                                                                            new ABlockStm(
                                                                                                new TLBrace("{"),
                                                                                                new AABlock(
                                                                                                    new ArrayList()
                                                                                                        {
                                                                                                            new AVoidReturnStm
                                                                                                                (new TReturn
                                                                                                                     ("return"))
                                                                                                        },
                                                                                                    new TRBrace("}")))),
                                                                             new AExpStm(new TSemicolon(";"),
                                                                                         assignment1),
                                                                             new AIfThenStm(new TLParen("("), binop8,
                                                                                            new ABlockStm(
                                                                                                new TLBrace("{"),
                                                                                                new AABlock(
                                                                                                    new ArrayList()
                                                                                                        {
                                                                                                            new AWhileStm
                                                                                                                (new TLParen
                                                                                                                     ("("),
                                                                                                                 unop2,
                                                                                                                 new ABlockStm
                                                                                                                     (new TLBrace
                                                                                                                          ("{"),
                                                                                                                      new AABlock
                                                                                                                          (new ArrayList
                                                                                                                               ()
                                                                                                                               {
                                                                                                                                   new AExpStm
                                                                                                                                       (new TSemicolon
                                                                                                                                            (";"),
                                                                                                                                        assignment2),
                                                                                                                                   new AIfThenStm
                                                                                                                                       (new TLParen
                                                                                                                                            ("("),
                                                                                                                                        binop13,
                                                                                                                                        new ABlockStm
                                                                                                                                            (new TLBrace
                                                                                                                                                 ("{"),
                                                                                                                                             new AABlock
                                                                                                                                                 (new ArrayList
                                                                                                                                                      ()
                                                                                                                                                      {
                                                                                                                                                          new AExpStm
                                                                                                                                                              (new TSemicolon
                                                                                                                                                                   (";"),
                                                                                                                                                               assignment3)
                                                                                                                                                      },
                                                                                                                                                  new TRBrace
                                                                                                                                                      ("}")))),
                                                                                                                                   new AIfThenStm
                                                                                                                                       (new TLParen
                                                                                                                                            ("("),
                                                                                                                                        binop14,
                                                                                                                                        new ABlockStm
                                                                                                                                            (new TLBrace
                                                                                                                                                 ("{"),
                                                                                                                                             new AABlock
                                                                                                                                                 (new ArrayList
                                                                                                                                                      ()
                                                                                                                                                      {
                                                                                                                                                          new ABreakStm
                                                                                                                                                              (new TBreak
                                                                                                                                                                   ("break"))
                                                                                                                                                      },
                                                                                                                                                  new TRBrace
                                                                                                                                                      ("}"))))
                                                                                                                               },
                                                                                                                           new TRBrace
                                                                                                                               ("}")))),
                                                                                                            new AExpStm(
                                                                                                                new TSemicolon
                                                                                                                    (";"),
                                                                                                                assignment4)
                                                                                                        },
                                                                                                    new TRBrace("}"))))
                                                                         },
                                                                      new TRBrace("}")));

                file.GetDecl().Add(method);
                data.Methods.Add(new SharedData.DeclItem<AMethodDecl>(file, method));

                data.FieldLinks[strUsedRef1] =
                    data.FieldLinks[strUsedRef2] =
                    data.FieldLinks[strUsedRef3] =
                    data.FieldLinks[strUsedRef4] = vars.Used;
                data.FieldLinks[strIndexRef1] =
                    data.FieldLinks[strIndexRef2] =
                    data.FieldLinks[strIndexRef3] = vars.Index;
                data.LocalLinks[iRef1] =
                    data.LocalLinks[iRef2] =
                    data.LocalLinks[iRef3] =
                    data.LocalLinks[iRef4] =
                    data.LocalLinks[iRef5] =
                    data.LocalLinks[iRef6] =
                    data.LocalLinks[iRef7] =
                    data.LocalLinks[iRef8] =
                    data.LocalLinks[iRef9] =
                    data.LocalLinks[iRef10] =
                    data.LocalLinks[iRef11] =
                    data.LocalLinks[iRef12] =
                    data.LocalLinks[iRef13] =
                    data.LocalLinks[iRef14] = iDecl;
                //data.SimpleMethodLinks[power2Invoke1] =
                //    data.SimpleMethodLinks[power2Invoke2] =
                //    data.SimpleMethodLinks[power2Invoke3] = CreatePower2Method(node, data);

                data.ExpTypes[intConst1] =
                    data.ExpTypes[intConst2] =
                    data.ExpTypes[intConst3] =
                    data.ExpTypes[intConst4] =
                    data.ExpTypes[intConst5] =
                    data.ExpTypes[intConst6] =
                    data.ExpTypes[intConst7] =
                    data.ExpTypes[intConst8] =
                    data.ExpTypes[intConst9] =
                    data.ExpTypes[intConst10] =
                    data.ExpTypes[intConst11] =
                    data.ExpTypes[intConst12] =
                    data.ExpTypes[intConst13] =
                    data.LvalueTypes[iRef1] =
                    data.LvalueTypes[iRef2] =
                    data.LvalueTypes[iRef3] =
                    data.LvalueTypes[iRef4] =
                    data.LvalueTypes[iRef5] =
                    data.LvalueTypes[iRef6] =
                    data.LvalueTypes[iRef7] =
                    data.LvalueTypes[iRef8] =
                    data.LvalueTypes[iRef9] =
                    data.LvalueTypes[iRef10] =
                    data.LvalueTypes[iRef11] =
                    data.LvalueTypes[iRef12] =
                    data.LvalueTypes[iRef13] =
                    data.LvalueTypes[iRef14] =
                    data.ExpTypes[iRef1Exp] =
                    data.ExpTypes[iRef2Exp] =
                    data.ExpTypes[iRef3Exp] =
                    data.ExpTypes[iRef4Exp] =
                    data.ExpTypes[iRef5Exp] =
                    data.ExpTypes[iRef6Exp] =
                    data.ExpTypes[iRef7Exp] =
                    data.ExpTypes[iRef8Exp] =
                    data.ExpTypes[iRef10Exp] =
                    data.ExpTypes[iRef11Exp] =
                    data.ExpTypes[iRef13Exp] =
                    data.ExpTypes[iRef14Exp] =
                    data.LvalueTypes[arrayIndex1] =
                    data.LvalueTypes[arrayIndex2] =
                    data.LvalueTypes[arrayIndex3] =
                    data.LvalueTypes[arrayIndex4] =
                    data.ExpTypes[arrayIndex1Exp] =
                    data.ExpTypes[arrayIndex3Exp] =
                    data.ExpTypes[arrayIndex4Exp] =
                    data.ExpTypes[binop1] =
                    data.ExpTypes[binop2] =
                    data.ExpTypes[binop3] =
                    data.ExpTypes[binop4] =
                    data.ExpTypes[binop5] =
                    data.ExpTypes[binop6] =
                    data.ExpTypes[binop7] =
                    data.ExpTypes[binop9] =
                    data.ExpTypes[binop10] =
                    data.ExpTypes[binop11] =
                    data.ExpTypes[binop12] =
                    data.ExpTypes[binop15] =
                    data.ExpTypes[binop16] =
                    data.ExpTypes[binop17] =
                    data.ExpTypes[paren1] =
                    data.ExpTypes[paren2] =
                    data.ExpTypes[assignment1] =
                    data.ExpTypes[assignment2] =
                    data.ExpTypes[assignment3] =
                    data.ExpTypes[assignment4] =
                    /*data.ExpTypes[power2Invoke1] =
                    data.ExpTypes[power2Invoke2] =
                    data.ExpTypes[power2Invoke3] =*/ new ANamedType(new TIdentifier("int"), null);

                data.ExpTypes[binop8] =
                    data.ExpTypes[binop13] =
                    data.ExpTypes[binop14] =
                    data.ExpTypes[unop1] =
                    data.ExpTypes[unop2] = new ANamedType(new TIdentifier("bool"), null);

                return method;
            }
            private static AMethodDecl CreateNewObjectMethodP(Node node, TIntegerLiteral intLiteral, string prefix, GlobalStructVars vars, SharedData data)
            {
                if (intLiteral == null)
                    return CreateNewObjectMethod(node, data);

                //if (createStructMethod.ContainsKey(structDecl))
                //    return createStructMethod[structDecl];

                /*
                    int CreateStr()
                    {
                        int i = Str_index;
                        while (Str_used[i / 31] & 1 << (i % 31))
                        {
                            i = i + 1;
                            if (i >= 42)
                            {
                                i = 0;
                            }
                            if (i == Str_index)
                            {
                                UIDisplayMessage(PlayerGroupAll(), c_messageAreaDebug, StringToText("Error: Unable to allocate more than 42 dynamic Str types"));
                                IntToString(1/0);
                            }
                        }
                        Str_used[i / 31] = Str_used[i / 31] + Power2(i % 31);
                        Str_index = i;
                        <<if it is being compared with null at any point in time>>
                            <<usedBits := floor(log2(42))+1>>
                            <<bitsLeft := 31 - usedBits>>
                            <<biggestIdentifier := 2^(bitsLeft + 1) - 1>>
                            identifierArray[i] = identifierNext;
                            i = (i << bitsLeft) + identifierNext;
                            identifierNext = identifierNext%biggestIdentifier + 1;
                        return i;
                    }
                 */

                AASourceFile file = Util.GetAncestor<AASourceFile>(node);

                AIntConstExp intConst1 = new AIntConstExp(new TIntegerLiteral("31"));
                AIntConstExp intConst2 = new AIntConstExp(new TIntegerLiteral("31"));
                AIntConstExp intConst3 = new AIntConstExp(new TIntegerLiteral("1"));
                AIntConstExp intConst4 = new AIntConstExp(new TIntegerLiteral(intLiteral.Text));
                AIntConstExp intConst5 = new AIntConstExp(new TIntegerLiteral("0"));
                AIntConstExp intConst6 = new AIntConstExp(new TIntegerLiteral("1"));
                AIntConstExp intConst7 = new AIntConstExp(new TIntegerLiteral("0"));
                AIntConstExp intConst8 = new AIntConstExp(new TIntegerLiteral("31"));
                AIntConstExp intConst9 = new AIntConstExp(new TIntegerLiteral("31"));
                AIntConstExp intConst10 = new AIntConstExp(new TIntegerLiteral("31"));

                AIntConstExp intConst11 = new AIntConstExp(new TIntegerLiteral("1"));
                AIntConstExp intConst12 = new AIntConstExp(new TIntegerLiteral("1"));

                AFieldLvalue strIndexRef1 = new AFieldLvalue(new TIdentifier(vars.Index.GetName().Text));
                AFieldLvalue strIndexRef2 = new AFieldLvalue(new TIdentifier(vars.Index.GetName().Text));
                AFieldLvalue strIndexRef3 = new AFieldLvalue(new TIdentifier(vars.Index.GetName().Text));
                ALvalueExp strIndexRef1Exp = new ALvalueExp(strIndexRef1);
                ALvalueExp strIndexRef2Exp = new ALvalueExp(strIndexRef2);

                AFieldLvalue strUsedRef1 = new AFieldLvalue(new TIdentifier(vars.Used.GetName().Text));
                AFieldLvalue strUsedRef2 = new AFieldLvalue(new TIdentifier(vars.Used.GetName().Text));
                AFieldLvalue strUsedRef3 = new AFieldLvalue(new TIdentifier(vars.Used.GetName().Text));
                ALvalueExp strUsedRef1Exp = new ALvalueExp(strUsedRef1);
                ALvalueExp strUsedRef2Exp = new ALvalueExp(strUsedRef2);
                ALvalueExp strUsedRef3Exp = new ALvalueExp(strUsedRef3);

                AALocalDecl iDecl = new AALocalDecl(new APublicVisibilityModifier(), null, null, null, null, new ANamedType(new TIdentifier("int"), null),
                                                    new TIdentifier("i"), strIndexRef1Exp);
                ALocalLvalue iRef1 = new ALocalLvalue(new TIdentifier("i"));
                ALocalLvalue iRef2 = new ALocalLvalue(new TIdentifier("i"));
                ALocalLvalue iRef3 = new ALocalLvalue(new TIdentifier("i"));
                ALocalLvalue iRef4 = new ALocalLvalue(new TIdentifier("i"));
                ALocalLvalue iRef5 = new ALocalLvalue(new TIdentifier("i"));
                ALocalLvalue iRef6 = new ALocalLvalue(new TIdentifier("i"));
                ALocalLvalue iRef7 = new ALocalLvalue(new TIdentifier("i"));
                ALocalLvalue iRef8 = new ALocalLvalue(new TIdentifier("i"));
                ALocalLvalue iRef9 = new ALocalLvalue(new TIdentifier("i"));
                ALocalLvalue iRef10 = new ALocalLvalue(new TIdentifier("i"));
                ALocalLvalue iRef11 = new ALocalLvalue(new TIdentifier("i"));
                ALocalLvalue iRef12 = new ALocalLvalue(new TIdentifier("i"));
                ALvalueExp iRef1Exp = new ALvalueExp(iRef1);
                ALvalueExp iRef2Exp = new ALvalueExp(iRef2);
                ALvalueExp iRef4Exp = new ALvalueExp(iRef4);
                ALvalueExp iRef5Exp = new ALvalueExp(iRef5);
                ALvalueExp iRef7Exp = new ALvalueExp(iRef7);
                ALvalueExp iRef8Exp = new ALvalueExp(iRef8);
                ALvalueExp iRef9Exp = new ALvalueExp(iRef9);
                ALvalueExp iRef10Exp = new ALvalueExp(iRef10);
                ALvalueExp iRef11Exp = new ALvalueExp(iRef11);
                ALvalueExp iRef12Exp = new ALvalueExp(iRef12);

                ABinopExp binop1 = new ABinopExp(iRef1Exp, new ADivideBinop(new TDiv("/")), intConst1);
                ABinopExp binop2 = new ABinopExp(iRef2Exp, new AModuloBinop(new TMod("%")), intConst2);
                ABinopExp binop3 = new ABinopExp(null, new AAndBinop(new TAnd("&")), null);
                ABinopExp binop4 = new ABinopExp(iRef4Exp, new APlusBinop(new TPlus("+")), intConst3);
                ABinopExp binop5 = new ABinopExp(iRef5Exp, new AGeBinop(new TGteq(">=")), intConst4);
                ABinopExp binop6 = new ABinopExp(iRef7Exp, new AEqBinop(new TEq("==")), strIndexRef2Exp);
                ABinopExp binop7 = new ABinopExp(intConst6, new ADivideBinop(new TDiv("/")), intConst7);
                ABinopExp binop8 = new ABinopExp(iRef8Exp, new ADivideBinop(new TDiv("/")), intConst8);
                ABinopExp binop9 = new ABinopExp(iRef9Exp, new ADivideBinop(new TDiv("/")), intConst9);
                ABinopExp binop10 = new ABinopExp(iRef10Exp, new AModuloBinop(new TMod("%")), intConst10);
                ABinopExp binop11 = new ABinopExp(null, new APlusBinop(new TPlus("+")), null);

                ABinopExp binop12 = new ABinopExp(intConst11, new ALBitShiftBinop(new TLBitShift("<<")), binop2);
                ABinopExp binop13 = new ABinopExp(intConst12, new ALBitShiftBinop(new TLBitShift("<<")), binop10);
                binop3.SetRight(binop12);
                binop11.SetRight(binop13);

                //ASimpleInvokeExp power2Invoke1 = new ASimpleInvokeExp(new TIdentifier("Power2"), new ArrayList() { binop2 });
                //ASimpleInvokeExp power2Invoke2 = new ASimpleInvokeExp(new TIdentifier("Power2"), new ArrayList() { binop10 });
                //binop3.SetRight(power2Invoke1);
                //binop11.SetRight(power2Invoke2);

                AArrayLvalue arrayIndex1 = new AArrayLvalue(new TLBracket("["), strUsedRef1Exp, binop1);
                AArrayLvalue arrayIndex2 = new AArrayLvalue(new TLBracket("["), strUsedRef2Exp, binop8);
                AArrayLvalue arrayIndex3 = new AArrayLvalue(new TLBracket("["), strUsedRef3Exp, binop9);
                ALvalueExp arrayIndex1Exp = new ALvalueExp(arrayIndex1);
                ALvalueExp arrayIndex3Exp = new ALvalueExp(arrayIndex3);
                binop3.SetLeft(arrayIndex1Exp);
                binop11.SetLeft(arrayIndex3Exp);

                AAssignmentExp assignement1 = new AAssignmentExp(new TAssign("="), iRef3, binop4);
                AAssignmentExp assignement2 = new AAssignmentExp(new TAssign("="), iRef6, intConst5);
                AAssignmentExp assignement3 = new AAssignmentExp(new TAssign("="), arrayIndex2, binop11);
                AAssignmentExp assignement4 = new AAssignmentExp(new TAssign("="), strIndexRef3, iRef11Exp);

                ASimpleInvokeExp playerGroupAllInvoke = new ASimpleInvokeExp(new TIdentifier("PlayerGroupAll"), new ArrayList());
                AFieldLvalue messageAreaDebugRef = new AFieldLvalue(new TIdentifier("c_messageAreaDebug"));
                ALvalueExp messageAreaDebugRefExp = new ALvalueExp(messageAreaDebugRef);
                AStringConstExp stringConst =
                    new AStringConstExp(
                        new TStringLiteral("\"Galaxy++ Error: Unable to allocate more than " + intLiteral.Text +
                                           " dynamic " + prefix + " types.\""));
                ASimpleInvokeExp stringToTextInvoke = new ASimpleInvokeExp(new TIdentifier("StringToText"), new ArrayList() { stringConst });
                ASimpleInvokeExp displayMessageInvoke = new ASimpleInvokeExp(new TIdentifier("UIDisplayMessage"),
                                                                             new ArrayList()
                                                                                 {
                                                                                     playerGroupAllInvoke,
                                                                                     messageAreaDebugRefExp,
                                                                                     stringToTextInvoke
                                                                                 });
                ASimpleInvokeExp intToStringInvoke = new ASimpleInvokeExp(new TIdentifier("IntToString"),
                                                                          new ArrayList() { binop7 });

                AABlock methodBlock = new AABlock(
                    new ArrayList()
                        {
                            new ALocalDeclStm(new TSemicolon(";"), iDecl),
                            new AWhileStm(new TLParen("("), binop3,
                                          new ABlockStm(new TLBrace("{"),
                                                        new AABlock(
                                                            new ArrayList()
                                                                {
                                                                    new AExpStm
                                                                        (new TSemicolon
                                                                             (";"),
                                                                         assignement1),
                                                                    new AIfThenStm
                                                                        (new TLParen
                                                                             ("("),
                                                                         binop5,
                                                                         new ABlockStm
                                                                             (new TLBrace
                                                                                  ("{"),
                                                                              new AABlock
                                                                                  (new ArrayList
                                                                                       ()
                                                                                       {
                                                                                           new AExpStm
                                                                                               (new TSemicolon
                                                                                                    (";"),
                                                                                                assignement2)
                                                                                       },
                                                                                   new TRBrace
                                                                                       ("}")))),
                                                                    new AIfThenStm
                                                                        (new TLParen
                                                                             ("("),
                                                                         binop6,
                                                                         new ABlockStm
                                                                             (new TLBrace
                                                                                  ("{"),
                                                                              new AABlock
                                                                                  (new ArrayList
                                                                                       ()
                                                                                       {
                                                                                           new AExpStm
                                                                                               (new TSemicolon
                                                                                                    (";"),
                                                                                                displayMessageInvoke),
                                                                                           new AExpStm
                                                                                               (new TSemicolon
                                                                                                    (";"),
                                                                                                intToStringInvoke)
                                                                                       },
                                                                                   new TRBrace
                                                                                       ("}"))))
                                                                },
                                                            new TRBrace(
                                                                "}")))),
                            new AExpStm(new TSemicolon(";"), assignement3),
                            new AExpStm(new TSemicolon(";"), assignement4)
                        },
                    new TRBrace("}"));

                if (vars.IdentifierArray != null)
                {
                    /*
                        <<if it is being compared with null at any point in time>>
                            <<usedBits := floor(log2(42))+1>>
                            <<bitsLeft := 31 - usedBits>>
                            <<biggestIdentifier := 2^(bitsLeft + 1) - 1>>
                            identifierArray[i] = identifierNext;
                            i = (i << bitsLeft) + identifierNext;
                            identifierNext = identifierNext%biggestIdentifier + 1;
                    */
                    int usedLimit = int.Parse(intLiteral.Text);
                    int usedBits = usedLimit == 0 ? 0 : ((int)Math.Floor(Math.Log(usedLimit, 2)) + 1);
                    int bitsLeft = 31 - usedBits;
                    int biggestIdentifier = (1 << (bitsLeft + 1)) - 1;

                    AIntConstExp bitsLeftConst = new AIntConstExp(new TIntegerLiteral(bitsLeft.ToString()));
                    AIntConstExp biggestIdentifierConst = new AIntConstExp(new TIntegerLiteral(biggestIdentifier.ToString()));
                    AIntConstExp oneIntConst = new AIntConstExp(new TIntegerLiteral("1"));
                    ALocalLvalue secondIRef1 = new ALocalLvalue(new TIdentifier("i"));
                    ALocalLvalue secondIRef2 = new ALocalLvalue(new TIdentifier("i"));
                    ALocalLvalue secondIRef3 = new ALocalLvalue(new TIdentifier("i"));
                    ALvalueExp secondIRef2Exp = new ALvalueExp(secondIRef2);
                    ALvalueExp secondIRef3Exp = new ALvalueExp(secondIRef3);
                    AFieldLvalue identierNExtRef1 = new AFieldLvalue(new TIdentifier("identiferNext"));
                    AFieldLvalue identierNExtRef2 = new AFieldLvalue(new TIdentifier("identiferNext"));
                    AFieldLvalue identierNExtRef3 = new AFieldLvalue(new TIdentifier("identiferNext"));
                    AFieldLvalue identierNExtRef4 = new AFieldLvalue(new TIdentifier("identiferNext"));
                    ALvalueExp identierNExtRef1Exp = new ALvalueExp(identierNExtRef1);
                    ALvalueExp identierNExtRef3Exp = new ALvalueExp(identierNExtRef3);
                    ALvalueExp identierNExtRef4Exp = new ALvalueExp(identierNExtRef4);
                    AFieldLvalue identifierArrayRef = new AFieldLvalue(new TIdentifier("identifierArray"));
                    ALvalueExp identifierArrayRefExp = new ALvalueExp(identifierArrayRef);

                    AArrayLvalue arrayLvalue = new AArrayLvalue(new TLBracket("["), identifierArrayRefExp, secondIRef3Exp);

                    AAssignmentExp secondAssignment3 = new AAssignmentExp(new TAssign("="), arrayLvalue, identierNExtRef4Exp);

                    methodBlock.GetStatements().Add(new AExpStm(new TSemicolon(";"), secondAssignment3));

                    ABinopExp secondBinop1 = new ABinopExp(secondIRef2Exp, new ALBitShiftBinop(new TLBitShift("<<")), bitsLeftConst);
                    ABinopExp secondBinop2 = new ABinopExp(secondBinop1, new APlusBinop(new TPlus("+")), identierNExtRef1Exp);

                    AAssignmentExp secondAssignment1 = new AAssignmentExp(new TAssign("="), secondIRef1, secondBinop2);

                    methodBlock.GetStatements().Add(new AExpStm(new TSemicolon(";"), secondAssignment1));

                    ABinopExp secondBinop3 = new ABinopExp(identierNExtRef3Exp, new AModuloBinop(new TMod("%")), biggestIdentifierConst);
                    ABinopExp secondBinop4 = new ABinopExp(secondBinop3, new APlusBinop(new TPlus("+")), oneIntConst);

                    AAssignmentExp secondAssignment2 = new AAssignmentExp(new TAssign("="), identierNExtRef2, secondBinop4);

                    methodBlock.GetStatements().Add(new AExpStm(new TSemicolon(";"), secondAssignment2));

                    data.LvalueTypes[secondIRef1] =
                        data.LvalueTypes[secondIRef2] =
                        data.ExpTypes[bitsLeftConst] =
                        data.ExpTypes[biggestIdentifierConst] =
                        data.ExpTypes[oneIntConst] =
                        data.ExpTypes[secondIRef2Exp] =
                        data.LvalueTypes[identierNExtRef1] =
                        data.LvalueTypes[identierNExtRef2] =
                        data.LvalueTypes[identierNExtRef3] =
                        data.ExpTypes[identierNExtRef1Exp] =
                        data.ExpTypes[identierNExtRef3Exp] =
                        data.ExpTypes[secondBinop1] =
                        data.ExpTypes[secondBinop2] =
                        data.ExpTypes[secondAssignment1] =
                        data.ExpTypes[secondBinop3] =
                        data.ExpTypes[secondBinop4] =
                        data.ExpTypes[secondAssignment2] =
                        data.LvalueTypes[secondIRef3] =
                        data.LvalueTypes[identierNExtRef4] =
                        data.ExpTypes[secondIRef3Exp] =
                        data.ExpTypes[identierNExtRef4Exp] =
                        data.LvalueTypes[arrayLvalue] =
                        data.ExpTypes[secondAssignment3] = new ANamedType(new TIdentifier("int"), null);

                    data.LvalueTypes[identifierArrayRef] =
                        data.ExpTypes[identifierArrayRefExp] = vars.IdentifierArray.GetType();

                    data.LocalLinks[secondIRef1] =
                        data.LocalLinks[secondIRef2] =
                        data.LocalLinks[secondIRef3] = iDecl;

                    data.FieldLinks[identierNExtRef1] =
                        data.FieldLinks[identierNExtRef2] =
                        data.FieldLinks[identierNExtRef3] =
                        data.FieldLinks[identierNExtRef4] = vars.IdentifierNext;

                    data.FieldLinks[identifierArrayRef] = vars.IdentifierArray;
                }

                methodBlock.GetStatements().Add(new AValueReturnStm(new TReturn("return"), iRef12Exp));

                AMethodDecl method = new AMethodDecl(new APublicVisibilityModifier(), null, null, null, null, null,
                                                                 new ANamedType(new TIdentifier("int"), null),
                                                                 new TIdentifier("Create" + prefix, data.LineCounts[file] + 18, 0),
                                                                 new ArrayList(),
                                                                 methodBlock);

                file.GetDecl().Add(method);
                data.Methods.Add(new SharedData.DeclItem<AMethodDecl>(file, method));

                data.LocalLinks[iRef1] =
                    data.LocalLinks[iRef2] =
                    data.LocalLinks[iRef3] =
                    data.LocalLinks[iRef4] =
                    data.LocalLinks[iRef5] =
                    data.LocalLinks[iRef6] =
                    data.LocalLinks[iRef7] =
                    data.LocalLinks[iRef8] =
                    data.LocalLinks[iRef9] =
                    data.LocalLinks[iRef10] =
                    data.LocalLinks[iRef11] =
                    data.LocalLinks[iRef12] = iDecl;
                data.FieldLinks[strUsedRef1] =
                    data.FieldLinks[strUsedRef2] =
                    data.FieldLinks[strUsedRef3] = vars.Used;
                data.FieldLinks[strIndexRef1] =
                    data.FieldLinks[strIndexRef2] =
                    data.FieldLinks[strIndexRef3] = vars.Index;
                //data.SimpleMethodLinks[power2Invoke1] =
                //    data.SimpleMethodLinks[power2Invoke2] = CreatePower2Method(node, data);
                data.FieldLinks[messageAreaDebugRef] =
                    data.Libraries.Fields.First(f => f.GetName().Text == messageAreaDebugRef.GetName().Text);
                data.SimpleMethodLinks[displayMessageInvoke] =
                    data.Libraries.Methods.First(m => m.GetName().Text == displayMessageInvoke.GetName().Text);
                data.SimpleMethodLinks[playerGroupAllInvoke] =
                    data.Libraries.Methods.First(m => m.GetName().Text == playerGroupAllInvoke.GetName().Text);
                data.SimpleMethodLinks[stringToTextInvoke] =
                    data.Libraries.Methods.First(m => m.GetName().Text == stringToTextInvoke.GetName().Text);
                data.SimpleMethodLinks[intToStringInvoke] =
                    data.Libraries.Methods.First(m => m.GetName().Text == intToStringInvoke.GetName().Text);

                data.ExpTypes[intConst1] =
                    data.ExpTypes[intConst2] =
                    data.ExpTypes[intConst3] =
                    data.ExpTypes[intConst4] =
                    data.ExpTypes[intConst5] =
                    data.ExpTypes[intConst6] =
                    data.ExpTypes[intConst7] =
                    data.ExpTypes[intConst8] =
                    data.ExpTypes[intConst9] =
                    data.ExpTypes[intConst10] =
                    data.ExpTypes[intConst11] =
                    data.ExpTypes[intConst12] =
                    data.LvalueTypes[strIndexRef1] =
                    data.LvalueTypes[strIndexRef2] =
                    data.LvalueTypes[strIndexRef3] =
                    data.ExpTypes[strIndexRef1Exp] =
                    data.ExpTypes[strIndexRef2Exp] =
                    data.LvalueTypes[iRef1] =
                    data.LvalueTypes[iRef2] =
                    data.LvalueTypes[iRef3] =
                    data.LvalueTypes[iRef4] =
                    data.LvalueTypes[iRef5] =
                    data.LvalueTypes[iRef6] =
                    data.LvalueTypes[iRef7] =
                    data.LvalueTypes[iRef8] =
                    data.LvalueTypes[iRef9] =
                    data.LvalueTypes[iRef10] =
                    data.LvalueTypes[iRef11] =
                    data.LvalueTypes[iRef12] =
                    data.ExpTypes[iRef1Exp] =
                    data.ExpTypes[iRef2Exp] =
                    data.ExpTypes[iRef4Exp] =
                    data.ExpTypes[iRef5Exp] =
                    data.ExpTypes[iRef7Exp] =
                    data.ExpTypes[iRef8Exp] =
                    data.ExpTypes[iRef9Exp] =
                    data.ExpTypes[iRef10Exp] =
                    data.ExpTypes[iRef11Exp] =
                    data.ExpTypes[iRef12Exp] =
                    data.LvalueTypes[arrayIndex1] =
                    data.LvalueTypes[arrayIndex2] =
                    data.LvalueTypes[arrayIndex3] =
                    data.ExpTypes[arrayIndex1Exp] =
                    data.ExpTypes[arrayIndex3Exp] =
                    data.ExpTypes[binop1] =
                    data.ExpTypes[binop2] =
                    data.ExpTypes[binop3] =
                    data.ExpTypes[binop4] =
                    data.ExpTypes[binop7] =
                    data.ExpTypes[binop8] =
                    data.ExpTypes[binop9] =
                    data.ExpTypes[binop10] =
                    data.ExpTypes[binop11] =
                    data.ExpTypes[binop12] =
                    data.ExpTypes[binop13] =
                    //data.ExpTypes[power2Invoke1] =
                    //data.ExpTypes[power2Invoke2] =
                    data.ExpTypes[intToStringInvoke] =
                    data.ExpTypes[assignement1] =
                    data.ExpTypes[assignement2] =
                    data.ExpTypes[assignement3] =
                    data.ExpTypes[assignement4] =
                    data.LvalueTypes[messageAreaDebugRef] =
                    data.ExpTypes[messageAreaDebugRefExp] = new ANamedType(new TIdentifier("int"), null);

                data.LvalueTypes[strUsedRef1] =
                    data.LvalueTypes[strUsedRef2] =
                    data.LvalueTypes[strUsedRef3] =
                    data.ExpTypes[strUsedRef1Exp] =
                    data.ExpTypes[strUsedRef2Exp] =
                    data.ExpTypes[strUsedRef3Exp] = vars.Used.GetType();

                data.ExpTypes[binop5] =
                    data.ExpTypes[binop6] = new ANamedType(new TIdentifier("int"), null);

                data.ExpTypes[stringConst] =
                    data.ExpTypes[intToStringInvoke] = new ANamedType(new TIdentifier("string"), null);

                data.ExpTypes[stringToTextInvoke] = new ANamedType(new TIdentifier("text"), null);

                data.ExpTypes[playerGroupAllInvoke] = new ANamedType(new TIdentifier("playergroup"), null);

                data.ExpTypes[displayMessageInvoke] = new AVoidType(new TVoid("void"));

                return method;
            }
 public override void OutABinopExp(ABinopExp node)
 {
     if (node.GetBinop() is AEqBinop || node.GetBinop() is ANeBinop)
     {
         if (node.GetLeft() is ANullExp || node.GetRight() is ANullExp)
         {
             if (node.GetLeft() is ANullExp)
             {
                 //Swap left and right
                 PExp temp = node.GetLeft();
                 node.SetLeft(node.GetRight());
                 node.SetRight(temp);
             }
             PExp exp = node.GetLeft();
             PType type = data.ExpTypes[exp];
             if (type is APointerType)
             {
                 if (node.GetBinop() is ANeBinop)
                 {
                     //Convert a != null to !(a == null)
                     AUnopExp unop = new AUnopExp(new AComplementUnop(new TComplement("!")), null);
                     node.ReplaceBy(unop);
                     unop.SetExp(node);
                     node.SetBinop(new AEqBinop(new TEq("==")));
                     data.ExpTypes[unop] = new ANamedType(new TIdentifier("bool"), null);
                 }
                 if (Util.IsIntPointer(node, ((APointerType)type).GetType(), data))
                 {
                     bool add = true;
                     foreach (PType pType in TypesWithIdentifierArray)
                     {
                         if (Util.TypesEqual(((APointerType)type).GetType(), pType, data))
                         {
                             add = false;
                             break;
                         }
                     }
                     if (add)
                         TypesWithIdentifierArray.Add(((APointerType)type).GetType());
                 }
             }
         }
     }
 }