Altered the compiler code to output to an arbitrary outstream rather than stdout.