Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
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":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (8)
As of 2024-04-18 16:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found