This paper begins by reviewing different methods of automatic programming while emphasizing the technique of Ant Programming (AP). AP uses an ant foraging metaphor in which ants generate a program by moving through a graph. Generalized Ant Programming (GAP) uses a context-free grammar and an Ant Colony System (ACS) to guide the program generation search process. There are two enhancements to GAP that are proposed in this paper. These are: providing a heuristic for path termination inspired by building construction and a novel pheromone placement algorithm. Three well-known problems— Quartic symbolic regression, multiplexer, and an ant trail problem—are experimentally compared using enhanced GAP (EGAP) and GAP. The results of the experiments show the statistically significant advantage of using this heuristic function and pheromone placement algorithm of EGAP over GAP.