This php lib parses pencil ep files into object trees that can be easily read without worrying about xml.  The resulting tree can be used for code generation.