Parse::RecDescent has been mentioned by other posters.
Parse::RecDescent can certainly do the job, but will it
be fast enough? There are two reasons why
Parse::RecDescent
is slow. First, it's written in pure Perl, and that loses on speed
compared to tools written in C. Second,
Parse::RecDescent
is a tool for parsing recursive descent grammars. And that's a pretty
broad class of grammars; any context insensitive grammar can be parsed
with a recursive descent parser.
Parse::RecDescent generates
trial-and-error parsers, all branches will be tested, until either a
parse has been found, or all options have been tried. This could mean
the parser consumes the entire string, figures out it cannot match,
backtracks to the beginning of the string, and tries again with another
rule.
Yacc based grammars don't backtrack (or backtrack at most one token).
By looking ahead just a single token, they can decide which rule to
apply, and then they do not have to try another rule, even if the
choosen rule turned out to lead to a mismatch. Subclasses of the
class of context free grammars, like LL(k), LR(k), LALR(k), etc
can decide which rule is needed by looking ahead a fixed number of
tokens.
Another thing to consider is that Parse::RecDescent does
not have a tokenizer. It generaters combined lexer/parsers.
Conclusion, Parse::RecDescent will very likely do the job.
But it might not give the performance you are seeking. I've never
worked with Parse::YAPP, so I will not comment on it.
Abigail
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.