WIP Tools for autogeneration of code

Rebased tools on master.