working parser generator!

needs heavy optimisation and to be split across multiple files
debugging