Add top-level compile() function that returns a template object

This is a simple implementation for #152. I was going to add a couple basic tests, which file is a good spot for that?