//TODO: Исправить коллекцию модулей.
        public PascalABCCompiler.TreeRealization.common_unit_node CompileInterface(SyntaxTree.compilation_unit SyntaxUnit,
                                                                                   PascalABCCompiler.TreeRealization.unit_node_list UsedUnits, List <Errors.Error> ErrorsList, List <Errors.CompilerWarning> WarningsList, PascalABCCompiler.Errors.SyntaxError parser_error,
                                                                                   System.Collections.Hashtable bad_nodes, TreeRealization.using_namespace_list namespaces, Dictionary <SyntaxTree.syntax_tree_node, string> docs, bool debug, bool debugging)
        {
            //convertion_data_and_alghoritms.__i = 0;
            stv.parser_error             = parser_error;
            stv.bad_nodes_in_syntax_tree = bad_nodes;
            stv.referenced_units         = UsedUnits;
            //stv.comp_units=UsedUnits;
            //stv.visit(SyntaxUnit
            //stv.interface_using_list = namespaces;
            stv.using_list.clear();
            stv.interface_using_list.clear();
            stv.using_list.AddRange(namespaces);
            stv.current_document          = new TreeRealization.document(SyntaxUnit.file_name);
            stv.ErrorsList                = ErrorsList;
            stv.WarningsList              = WarningsList;
            stv.SymbolTable.CaseSensitive = SemanticRules.SymbolTableCaseSensitive;
            stv.docs      = docs;
            stv.debug     = debug;
            stv.debugging = debugging;
            SystemLibrary.SystemLibrary.syn_visitor = stv;
            SetSemanticRules(SyntaxUnit);


            foreach (SyntaxTree.compiler_directive cd in SyntaxUnit.compiler_directives)
            {
                cd.visit(stv);
            }

            stv.DirectivesToNodesLinks = CompilerDirectivesToSyntaxTreeNodesLinker.BuildLinks(SyntaxUnit, ErrorsList);  //MikhailoMMX добавил передачу списка ошибок (02.10.10)

            SyntaxUnit.visit(stv);

            /*SyntaxTree.program_module pmod=SyntaxUnit as SyntaxTree.program_module;
             * if (pmod!=null)
             * {
             *      stv.visit(pmod);
             * }
             * else
             * {
             *      SyntaxTree.unit_module umod=SyntaxUnit as SyntaxTree.unit_module;
             *      if (umod==null)
             *      {
             *              throw new PascalABCCompiler.TreeConverter.CompilerInternalError("Undefined module type (not program and not unit)");
             *      }
             *      stv.visit(umod);
             * }*/
            //stv.visit(SyntaxUnit);
            //if (ErrorsList.Count>0) throw ErrorsList[0];
            return(stv.compiled_unit);
        }
		public CompilationUnit ReadDLL(string FileName)
		{
            if (DLLCashe.ContainsKey(FileName))
                return DLLCashe[FileName];
            OnChangeCompilerState(this, CompilerState.ReadDLL, FileName);
            TreeRealization.using_namespace_list using_namespaces = new TreeRealization.using_namespace_list();
            try
            {
                TreeRealization.dot_net_unit_node un =
                    new TreeRealization.dot_net_unit_node(new NetHelper.NetScope(using_namespaces,
                    /*System.Reflection.Assembly.LoadFrom(FileName)*/
                    PascalABCCompiler.NetHelper.NetHelper.LoadAssembly(FileName), SyntaxTreeToSemanticTreeConverter.SymbolTable));
                CompilationUnit cu = new CompilationUnit();
                cu.SemanticTree = un;

                //un.dotNetScope=new PascalABCCompiler.NetHelper.NetScope(using_namespaces,
                //	System.Reflection.Assembly.LoadFrom(FileName),SyntaxTreeToSemanticTreeConverter.SymbolTable);
                DLLCashe[FileName] = cu;

                return cu;
            }
            catch (Exception e)
            {
                return null;
            }
		}
        public void CompileImplementation(PascalABCCompiler.TreeRealization.common_unit_node SemanticUnit,
                                          SyntaxTree.compilation_unit SyntaxUnit, PascalABCCompiler.TreeRealization.unit_node_list UsedUnits, List <Errors.Error> ErrorsList, List <Errors.CompilerWarning> WarningsList,
                                          PascalABCCompiler.Errors.SyntaxError parser_error, System.Collections.Hashtable bad_nodes, TreeRealization.using_namespace_list interface_namespaces, TreeRealization.using_namespace_list imlementation_namespaces,
                                          Dictionary <SyntaxTree.syntax_tree_node, string> docs, bool debug, bool debugging)
        {
            //if (ErrorsList.Count>0) throw ErrorsList[0];
            stv.parser_error             = parser_error;
            stv.bad_nodes_in_syntax_tree = bad_nodes;
            stv.referenced_units         = UsedUnits;

            stv.using_list.clear();
            stv.using_list.AddRange(interface_namespaces);
            stv.interface_using_list.AddRange(interface_namespaces);
            stv.using_list.AddRange(imlementation_namespaces);
            stv.ErrorsList   = ErrorsList;
            stv.WarningsList = WarningsList;
            stv.SymbolTable.CaseSensitive = SemanticRules.SymbolTableCaseSensitive;
            if (docs != null)
            {
                stv.docs = docs;
            }
            stv.debug     = debug;
            stv.debugging = debugging;
            SystemLibrary.SystemLibrary.syn_visitor = stv;
            SetSemanticRules(SyntaxUnit);

            SyntaxTree.unit_module umod = SyntaxUnit as SyntaxTree.unit_module;
            if (umod == null)
            {
                throw new PascalABCCompiler.TreeConverter.CompilerInternalError("Program has not implementation part");
            }
            //TODO: Переделать, чтобы Сашин код работал с common_unit_node.
            stv.compiled_unit    = (PascalABCCompiler.TreeRealization.common_unit_node)SemanticUnit;
            stv.current_document = new TreeRealization.document(SyntaxUnit.file_name);

            foreach (SyntaxTree.compiler_directive cd in umod.compiler_directives)
            {
                cd.visit(stv);
            }

            stv.visit_implementation(umod);

            //stv.visit(SyntaxUnit);
            //return stv.compiled_unit;
        }