Clean up various scope and naming issues in antlr.py
Some import fixes
Refactor file writing tests
Ignore test output directory