Beefy Boxes and Bandwidth Generously Provided by pair Networks vroom
Just another Perl shrine
 
PerlMonks  

internal engine of regular expression

by spadacciniweb (Deacon)
on Dec 14, 2005 at 15:58 UTC ( #516679=perlquestion: print w/ replies, xml ) Need Help??
spadacciniweb has asked for the wisdom of the Perl Monks concerning the following question:

I am trying documentation of Regular Expression, but not a traditional guide, I want to be documented to interal engine about reguar expression.
A document would be perfect that it explains the Abstract State Machine of RegExp.

thank you.

Comment on internal engine of regular expression
Re: internal engine of regular expression
by swampyankee (Parson) on Dec 14, 2005 at 16:07 UTC

    Ciao. The Camel Book (Wall, L, Christiansen, T, and Schwartz, R, Programming Perl, 2/ed, O'Reilly & Associates, Sebastapol, CA: 1996 has some explanation of the regexp engine. For detailed information about the internal workings of the regexp engine you could read the code, or, probably a trifle less painful, ask Mr Schwartz or Mr Wall very nicely. Before doing either, I'd do a super search.

Re: internal engine of regular expression
by eff_i_g (Curate) on Dec 14, 2005 at 16:13 UTC
Re: internal engine of regular expression
by philcrow (Priest) on Dec 14, 2005 at 16:48 UTC
    If you really want to know how to write an engine you probably need to start with some compiler theory. The traditional text for this is the dragon book ISBN 0201100886 by Aho and others. Other treatments may or may not be more helpful. Try searching for 'compiler design' on your favorite on-line bookseller. These books explain parsing theory and their state machines.

    None of the above is useful for writing regexes that work well. For that follow the advice offered earlier (especially the advice to read Friedl's book on regexes).

    Phil Update:Added isbn tag.

Re: internal engine of regular expression
by demerphq (Chancellor) on Dec 14, 2005 at 17:10 UTC

    Heh, as soon as you find some documentation on how Perls regex engine works be sure to send it to the perl5porters mailing list. I believe there is certain level of consensus that the regex engine implementation is one of the most difficult and minimally documented part of Perl.

    ---
    $world=~s/war/peace/g

Re: internal engine of regular expression
by davido (Archbishop) on Dec 14, 2005 at 18:00 UTC

    I have to second that the Owls book, Mastering Regular Expressions, by Jeffery Friedl, published by O'Reilly & Associates is going to be your best bet. It doesn't dive into the actual code of Perl's RE engine, but it does offer a good discussion of DFA and NFA differences and attributes. And there's nowhere (including the POD) where you'll find a more thorough discussion of Perl's regular expression engine. Friedl himself does have a very thorough understanding of the code behind Perl's regular expression engine. However, if you have a specific need, you might try contacting one of the P5P individuals.


    Dave

Re: internal engine of regular expression
by planetscape (Canon) on Dec 15, 2005 at 16:55 UTC
Re: internal engine of regular expression
by spadacciniweb (Deacon) on Jan 23, 2006 at 17:54 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://516679]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (7)
As of 2014-04-20 11:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (485 votes), past polls