Start reimplementing code generation to use new symbol module

Most of the credit for this goes to Jos. A lot of cases are still
missing, and it cannot yet be tested because significant pieces of the
symbol module are actually missing!