The development of control laws for underactuated mechanical systems with pendulum-like behaviors is of paramount importance due to their use in the modeling of more complex systems and other challenging tasks. The underactuated feature describes constraints in the maneuverability and capabilities of a mechanical system with the advantage of offering less energy consumption. In this work, a novel methodology for solving the automation of evolved nonlinear controllers for the swing-up phase of switching control laws for underactuated inverted pendulums is proposed. Automatic synthesis of linear controllers with optimal performance applied to linear systems modeled as transfer functions is a forward leap proposed by Koza in 2003. Our proposed approach introduces the nonlinear nature within the automated construction of a set of swing-up controllers integrating an evolutionary process based on GP. The presented framework is based on an analytic behaviorist setup that merges Control Theory with Genetic Programming. Control Theory is applied to formulate the mathematical description of the problem and the design of the fitness function that guides the automated synthesis; Genetic Programming is implemented as an evolutionary engine for the construction of the solutions. The advantage is that the symbolic feature of Genetic Programming is exploited to develop large sets of nonlinear controllers that can be further studied with analytic tools from the Control Theory approach. The proposed framework is applied to an underactuated two-link inverted pendulum giving a set of 13590 evolved nonlinear swing-up controllers with the same and better fitness value than a state-of-the-art human-made design.