Major parsing refactor.

* Merge types and patterns into expression hierarchy.
* Add yaml config to generate expression classes automatically (replaces
the hardcoded python d