[WIP] Refactoring/php parser code generation

WIP for #1