//-----------------------------------------------------------
        private Type Visit(ReturnStatement node, Table table)
        {
            if (table is GlobalSymbolTable)
            {
                if (node.Count() != 0)
                {
                    throw new SemanticError("Return statement cannot return values in main section", node.AnchorToken);
                }
                return(Type.VOID);
            }
            else
            {
                Type returnType = Visit((dynamic)node[0], table);
                //Search for the procedure in which the return statement was called and compare return types
                foreach (KeyValuePair <string, GlobalProcedure> entry in GPTable)
                {
                    var proc = entry.Value;
                    if (proc.LocalSymbols == table)
                    {
                        if (proc.ReturnType != returnType)
                        {
                            throw new SemanticError("Incorrect return statement. Expecting a " + proc.ReturnType + ", but found a " + returnType, node.AnchorToken);
                        }
                        break;
                    }
                }

                return(returnType);
            }
        }