If it's a bit like SQL, then you'll save yourself a lot of trouble if you can describe first your toy language as a BNF; here's on for SQL-92. From there, sure there are modules that will allow you to create a parser for it. But the question then becomes, what are you going to do once you get the abstract syntax tree (AST), which is what you get once it's "parsed"?
Mind sharing a comprehensive example of usage? It may be that you don't need to invent your own DSL, and what you really need are just a few well chose keywords implemented as a subset of Perl (or perhaps creative use of prototype)?
FWIW, the approach to create your own set of DSL keywords is likely more expedient and easier than literally creating your own "language". Did you know Lua started off as a way to describe data? It's also what's used in programs like nmap to implement it's own DSL. Similarly, mysqlproxy uses it. I know you said you need to stick with Perl 5, but Inline::Lua might help.
-
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.
|