Add StaticEntity to tgen, move a lot of tgen logic to tgen.pyx, and finally, use tgen to create defs.py