Initial work on AST generation. Bit broken.