"Chris" == Chris Warren writes:
Chris> As part of my job, I have to do a lot of work munging message
Chris> files; each file contains information about multiple
Chris> messages. After writing a few programs that get specific bits
Chris> of information out of these files, I'm starting to think that a
Chris> proper parser is what's needed, and any time I need information
Chris> out of the message files, I can use this standard parser to get
Chris> whatever I need.
Chris> My first problem with this theory of mine is that I don't have
Chris> a formal computer-science education, and I don't think I
Chris> understand parsers (and, more on-topic, Parse::RecDescent) well
Chris> enough to write one. Can anyone recommend a good book or
Chris> tutorial on the subject of parsers, or should I stick to
Chris> piecemeal solutions until I find a computer-science degree?
I've heard that the O'Reilly "Yacc and Lex" book offers a good gentle
introduction for first-timers to parsers and lexers, although I've not
personally read it. (I haven't read *every* O'Reilly book yet -- they
keep coming out with too many of them! :)
And to give you hope, *I* also don't have a formal CS education in the
slightest. I learned parsers by studying the Unix docs for Yacc some
20 years ago, and lexers by studying the Unix Lex docs, and wrote a
program similar to my "spew"
>, and part of
the P::RD distro now) in Yacc and Lex as a personal exercise to see if
I understood. I still haven't a clue what LALR and LL mean, and I can
barely tell the difference between recursive descent and the rest, but
I know P::RD rocks cuz it's Damian code. :)
Of course, the action language for Yacc and Lex is C. You've got it
tons easier to do the same thing with P::RD, because the action
language is Perl. :)
Hope that helps... and if anyone finds something better than
O'Reilly's book, let *me* know so I can recommend it as well.
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!