This leaves in place a bunch of TODOs and likely many bugs - notably, I haven't tested codegen/layout at all here.