[PEPr] Comment on PHP::Lexer
| From: | Louis Mullie | Date: | Fri, 28 Jan 2005 23:21:25 +0000 |
| Subject: | [PEPr] Comment on PHP::Lexer | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-35773@lists.php.net to get a copy of this message | ||
Louis Mullie (http://pear.php.net/user/louism) has commented on the proposal for PHP::Lexer.
Comment:
Nikolas :
I will defintely use a structure of this sort, great idea. My
understanding of finite state machines is quite basic, so I still have to
learn more before I code an FSM version. There is already a port of phpLex
(a port of Jlex to C# that produces PHP code) to PHP
(http://cvs.joshuaeichorn.com/cvs.php/phpLex?Horde=fb50029ef79f4b20489a7047830a435d)
that produces a finite state machine; I could definitely adapt it to PEAR.
Bertrand :
"I'm also afraid if people like to have some '/' in patterns."
They are escaped automatically.
"Why compile again (make to regexp) if we want to analyse several strings
for the same grammar ?"
I'll definitely cache the regex, and as Nikolas said I'll add an option to
pass an already compiled form.
The implentation is suggest is (vastly based of what Nikolas said):
o class Lexer_Grammar: grammar as it is now, with some modifications to
conform to the FLEX way (i.e. define identifiers, then add patterns
associated with callbacks)
o class Lexer_Grammar_Flex extends Lexer_Grammar : ability to convert a
FLEX file to a compatible grammar definition
o abstract class Lexer : factory for any type of Lexer and interface
definition
o class Lexer_Regex : implementation as it is now
o class Lexer_FSM : eventually, implementation of a finite state machine
based Lexer
Any comments on this ?
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