Refactor array initialisation

Move array initialisation into its own class and move more stuff out of
codegen.cs. This isn't complete and needs a bit more cleanup but is
enough for now. Also support substring initialisation in DATA and add a
couple of new sample programs.