A friend and myself are attempting to build a compiler for PHP, that will compile PHP code into native i86/Linux assembly code. As part of this project, we have developed
- an abstract grammar for PHP, - a C++ class structure for this abstract grammar, - a parser that takes any PHP script and returns the corresponding object structure (abstract syntax tree), - an unparser that dumps a tree in this format back to normal PHP code - an unparser that dumps the tree in DOT format, and finally - an API for transforming/traversing the tree
The first release, licensed under the GPL and containing all of the above, can be found at http://www.phpcompiler.org. That website also contains reference documentation and getting started tutorials.