AbstractA new method for automatic programming is proposed in this paper. Automatic programming is the method of generating computer programs automatically. Genetic programming (GP) is a typical example of automatic programming. GP evolves computer programs with tree structure based on genetic algorithm (GA). The new method is named dynamic ant programming (DAP). DAP is based on ant colony optimization (ACO) and uses dynamically changing pheromone table. The nodes (terminal and nonterminal) are selected using the value of pheromone table. The higher the rate of pheromone, the higher is the probability that it can be chosen. Although the search space (i.e., the pheromone table of DAP) is dynamically changing, the ants find good solution using portions of solutions, which are of pheromone value. We describe the method of construction of tree structure using ACO, as well as pheromone update and deletion and insertion of nodes in detail. DAP is applied to the symbolic regression problem that is widely used as a test problem for GP system. We compare the performance of DAP to GP and show the effectiveness of DAP. In order to investigate the influence of several parameters, we compare experimental results obtained using different settings. © 2008 Institute of Electrical Engineers of Japan. Published by John Wiley & Sons, Inc.