PHP_Parser class - any plans?
| From: | Simon Willison | Date: | Thu, 16 May 2002 17:19:38 +0000 |
| Subject: | PHP_Parser class - any plans? | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-6160@lists.php.net to get a copy of this message | ||
Are there any plans to put together a PEAR tool for parsing and "understanding" PHP scripts? Several times over the past few months I have come across situations where such a thing could be useful, mostly related to documentation. For example, a well written parser class could allow the construction of a tool like lxr (as used on http://lxr.php.net/ ) for "browsing" PHP source code. It could also be very useful for writing debuggers, profilers and other development tools.
I have no experience of language parsing at all but I imagine it's a lot more complicated than just putting together a few regular expressions. Is it even viable to write such a thing in PHP or would it make more sense to write it as a C extension (perhaps for PECL) that re-uses some of the parsing code from the actual Zend engine?
In fact now that I think about it PHP's built in syntax highlighting functions must have access to a parser of some sort. How hard would it be to add an interface to this parser (I would have thought this is straying in to PHP development territory as opposed to PEAR).
Regards,
Simon Willison