Shape Inference and Grammar Induction for Example-based Procedural Generation