compiler: consolidate code from users' generate_src into a Main class