preliminary support for parsing and printing split queries

Peter, can you take a quick look and see if this seems like a reasonable approach so far?
This won't necessarily print things in the right order. I think you need to save the result of printInst to a variable as is done elsewhere.