Refactor ErrorListeners and CompilationResultWriter