Goals as Reward-Producing Programs