implementation of the poly to e2 compiler