Reformed the tests for yacc.py

Minor code-style changes to yacc. Added traceback to errors in
`get_output`.