Semantics for Probabilistic Programming: Higher-Order Functions, Continuous Distributions, and Soft Constraints