major affort to bring changes from ajanker fork back to original repo

ckaestne/TypeChef and ajanker/TypeChef diverged long time ago. This patch set contains relevant changes for the repo; it fixes several issues (parsing, typing) and updates to the last decl-use implementation. The changes may be relevant for different applications of TypeChef.