I presume that your web application is in perl; if so, then using perl for scripting needs no additional resources. Personally, I do not understand the disadvantages of option 2. What is wrong with having the power of perl at your disposal? Training will be needed in any case, whether it is perl or your custom language, and I suspect that admins would be more willing to learn a language that is useful for other things than a single use custom language.

But suppose you don't buy this argument. I would look first to Template Toolkit and/or Mason for ideas on how to implement your little language and integrate it with HTML.

If those are not extendable to your needs, then a full parser is in your future. First, you will have to create a language and forge a grammar that has no pathologies and is unambiguous. P::RD is a good choice for the parser, as there are many example grammars out there to learn from. Another choice is to create your own top-down parser. Nonterninals are mapped to subs, terminals to regexes, and translation can either be done as you parse, or later walking the parse tree.

Whether you use P::RD or roll your own, you will want to learn how to create good grammars, handle variables and symbol tables and detect all manner of syntax errors. The best book I know of for these tasks is Compilers: Principles, Techniques and Tools, by Aho, Sethi and Ullman.

-Mark


In reply to Re: Embedded perl or mini-language translator to perl by kvale
in thread Embedded perl or mini-language translator to perl by mp

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.