[PEPr] Comment on PHP::Lexer
| From: | Nikolas Coukouma | Date: | Fri, 28 Jan 2005 02:28:13 +0000 |
| Subject: | [PEPr] Comment on PHP::Lexer | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-35748@lists.php.net to get a copy of this message | ||
Nikolas Coukouma (http://pear.php.net/user/atrus) has commented on the proposal for PHP::Lexer.
Comment:
Do you have plans to produce a finite state machine version?
If so, it might make sense to have classes:
Lexer - factory
Grammar
Lexer_Common - interface definition
Lexer_Regex - a subclass/implementation of Lexer_Common
It would make the implementation clear while providing an oppurtunity for
other implementations.
As for the issue of compilation, it's not particularly difficult or
useless. You're already compiling the grammar into a regular expression (a
particular string representation).
If you were generating a finite state machine, you might store it as a
class (possibly in string form as well). The SOAP package does this
internally.
You could generalize getParallelRegex and rename it to something like
getCompiledForm. You could then make the compiled form an optional
parameter to the constructor. If it's provided, then you don't need to
recompile the grammar.
I'd also move it into the Lexer class because it depends more on that
implementation than on Grammar itself.
Proposal information:
http://pear.php.net/pepr/pepr-proposal-show.php?id=197
--
Sent by PEPr, the automatic proposal system at http://pear.php.net