A Knowledge-Based System for Automatic Program Construction