Why?

You have a program that has been working fine for 8 months. It breaks the problem up in small pieces, and it uses a simple solution for all the pieces. From the description you are giving, about the only thing that's against it is reading in a file twice, and some streamlining could have been programmed in. But overall, you have a pretty good program, and it works.

But now you have an urge to rewrite it. And what my impression is, in a more complex way. I'd say, don't do it.

I think I am that point but what criteria do I use to determine whether I should stop using plain regexes and consider using Parse::RecDescent?
Never. If you can do it with plain regexes, do it with plain regexes. Regexes can backtrack, but Parse::RecDescent will backtrack much more, unless you put a lot of work in it. Parse::RecDescent is slow. You'd only use Parse::RecDescent if your problem can't be solved with plain regexes. And even then you might want to consider regexes with advanced features over Parse::RecDescent. I can't prove it (yet), but I think that anything that can be parsed with a Parse::RecDescent parser, can be parsed with a regex (except perhaps cases where you modify the parser mid-parse).

Abigail


In reply to Re: To parse or not to parse by Abigail-II
in thread To parse or not to parse by set_uk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.