Add better support for exception handling and Scala "syntactic suger"

This all started when I realized there was some code repition around the concept of a top level AST. I also had reason to suspect that this meant a corner case was being missed. So I added a test case for that corner case. However the corner case turned out to be a little trickier to fix than simply factoring the code. But still, the fix coincides with a better factoring of the code I believe.

I took the chance to rename some things that believe could be better named.