1. A method for synthesizing a computer program by a hardware processor and a program synthesizer, the method comprising: representing program components and registers by position set variables and constraints on the position set variables using Monadic Second-Order Logic, the constraints comprising one or more register syntax constraints; determining potential combinations of the program components by solving the constraints; and forming the computer program by automatically synthesizing the computer program from at least one of the potential combinations, the automatically synthesizing being performed using the program synthesizer executing on the hardware processor.