Refactor zinc logic out of scala_compile.py

This has been tested and seems to have no regressions.