//-----------------------------------------------------------
        private Type Visit(ForStatement node, Table table)
        {
            LoopNestingLevel++;

            Type varType = Visit((dynamic)node[0], table);

            var varName = node[0].AnchorToken.Lexeme;
            GlobalSymbolTable gstable = table as GlobalSymbolTable;
            LocalSymbolTable  lstable = table as LocalSymbolTable;

            if (table is GlobalSymbolTable)
            {
                if (gstable[varName].IsConstant)
                {
                    throw new SemanticError("Loop variable " + varName + " cannot be a constant", node[0].AnchorToken);
                }
            }
            else
            {
                if (lstable.Contains(varName))
                {
                    if (lstable[varName].Kind != Clasification.VAR)
                    {
                        throw new SemanticError("Loop variable " + varName + " cannot be a constant or parameter", node[0].AnchorToken);
                    }
                }
                else
                {
                    if (GSTable[varName].IsConstant)
                    {
                        throw new SemanticError("Loop variable " + varName + " cannot be a constant", node[0].AnchorToken);
                    }
                }
            }

            Type iterableType = Visit((dynamic)node[1], table);

            if (iterableType == Type.LIST_OF_BOOLEAN)
            {
                if (varType != Type.BOOLEAN)
                {
                    throw new SemanticError("Incorrect loop variable \"" + varName + "\". Expecting " + Type.BOOLEAN + ", but found " + varType, node[0].AnchorToken);
                }
            }
            else if (iterableType == Type.LIST_OF_INTEGER)
            {
                if (varType != Type.INTEGER)
                {
                    throw new SemanticError("Incorrect loop variable \"" + varName + "\". Expecting " + Type.INTEGER + ", but found " + varType, node[0].AnchorToken);
                }
            }
            else if (iterableType == Type.LIST_OF_STRING)
            {
                if (varType != Type.STRING)
                {
                    throw new SemanticError("Incorrect loop variable \"" + varName + "\". Expecting " + Type.STRING + ", but found " + varType, node[0].AnchorToken);
                }
            }
            else
            {
                throw new SemanticError("Loop can only iterate over list types, but found " + iterableType, node[1].AnchorToken);
            }

            for (var i = 2; i < node.Count(); i++)
            {
                Visit((dynamic)node[i], table);
            }

            LoopNestingLevel--;
            return(Type.VOID);
        }