Reimplement compiler and code generator as coroutines.

This has two main benefits:

- a much more general visitation pattern that can be used in a
  dependency checker (which is what resolver.rb will be)
- it's neat