heh, it seems like every damned post I put on here is touting the greatness of Parse::RecDescent, but yes, i agree with the previous poster 100% that you should look into this, and have Parse::RecDescent generate an automata for you that you can then distribute without having to have your users have Parse::RecDescent.

However, I think it is a little bit more involved than that. The most important thing that I learned in both my compiler class and my programming language theory class in college was that belive it or not, we would ALL be using compiler theory and programming language theory for the rest of our professional lives. The professor made it very clear to us that we needed to understand that things such as UI's and configuration files, were really just a subset of the concept of a programming language, and if we didn't take the rules of proper programming language design into account, our users, and those that maintained our code would curse our names 'till the very end.

If you are at a point whereby you are willing to scrap your current configuration system, then I suggest you do so, and you take a few days to think about a few things. This configuration language, is going to have to be expressive enough for you to accomplsih what you need accomplished, and extensible enough for you to be able to grow it out however it needs to be grown out in the future. Things to take into account are:

if your "meta language" fits all of those, then you will be able to use it for a long time successfully. my second bit of advice is spend some time upfront defining the BNF for it, so that if the enviroment changes, you will always have the formal language defenition to fall back on to create a parser. If you take all of these things into account, and you use the proper modules (i'm telling you, Parse::RecDescent is a gift from whatever god or gods may or may not exist) you should have no problems expanding this into the future.

In reply to Re: Configuration file parsing? by eduardo
in thread Configuration file parsing? by Anonymous Monk

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.