Syntactic Control of Language Models by Posterior Inference