constructors & getters-setters

Same as #187
This branch has the same code as in #186 but has a lot cleaner history.
Difference is several additional tests that were somehow lost in #186 and ElimLocals and Flatten being in `transform` package