Hi, I found a thread which started with A proposal for more powerful text processing to be built in to Perl: Flex and Pushdown Expressions.
> One of the great strengths of Perl is that, more than any other > language I know, it helps you cross between the "data" space and the > "program" space: eval(), built in regex notation, etc. Even with the > considerable expressive power already at our disposal, I would like to > suggest that there might be a trifling additional feature or two that > perhaps would round out the language by their addition. My apologies > if these have been discussed before. > Flex - Put all of flex right into Perl. Flex is simply an event > engine (-compiler) for driving calls against code according to regular > expression matching events. While it is often convenient to have the * ... Why change perl ? It is possible to use flex directly in perl with XS or Inline. I have a module that does that and I plan an Inline::Yacc and an Inline::Recdecent. I just mailed to the Inline group and I will upload it to Cpan as soon as I get a green light. one of the answers to the message was : > Don't we already have that in Perl 5? > > if ( /\G\s+/gc ) { # whitespaces } > elsif ( /\G[*/+-]/gc ) { # operator } > elsif ( /\G\d+/gc ) { # term } > elsif ( /\G.+/gc ) { # unrecognized token } > > Tad McClellan The answer is NO, regexes and a lexer are totally different. I would recommend Tad to study a bit more what parsing is before thinking it's jut about writing regexes. Having a lexer allows perl do some kind of text processing (raw lexing and parsing) at a much faster. If it is of some interest I could benchmark a simple example. Nadim.