unit tests for ast builder; standardize error reporting somewhat