Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
Beside the easily found example that I felt only scratched the surface, how spread is the use of DSLs?

A DSL is like things that are hard to define, but you know it when you see it. Perl has at least 2, regular expressions and XS. Any program that provides for language like constructs in their configurations or for which you can write "scripts". Matlab is a DSL for matrix operations. Erlang began as a prolog-based DSL. Ragel State Compiler uses a DSL. Some would call PHP a DSL for web applications. varnish cache has a DSL; httpproxy does...I'd say they're incredibly wide spread - some more functional than others. The key concept is that is tailored for a specific domain (application). I once wrote an XML based DSL for scripting the interaction of remotely connected computers over ssh. The engine was written in Perl.

Furthermore, when taking into account the difficulty of designing and maintaining a language (I found grammar and syntax to be complicated to do well, but it might just be me) why not use pure lua to script your application?

I've never embedded a scriptable interface, but the main language you use is for you; Lua is used to support a DSL that is tailored for your users. It's up to you, I've never seriously looked into doing something like this, so others might have a better opinion. Also, when using Lua to create a DSL, I think you're focused more on special functions rather than actual grammars. This is where Lua takes over; you just define and implement your special functions (and keywords?). E.g., Lua gives you "if" and other tradition language constructs.

What are some good ressources on the most maintainable design patterns used when you need to come up with an architecture for supporting user written addons? (I read Module::Pluggable documentation's but I could not think of a way to make it able to directly use lua scripts without having to wrap each of them in a perl module

Honestly, I'd look at the applications you mentioned before (Snort, Nmap); I'd look at mysqlproxy, varnish cache, Redis. I don't have any examples of a Perl application using Lua, but they've got to be out there.


In reply to Re: it's scripts all the way down! by perlfan
in thread it's scripts all the way down! by QuillMeantTen

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 or How to display code and escape characters are good places to start.
Log In?

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (3)
As of 2022-08-16 19:43 GMT
Find Nodes?
    Voting Booth?

    No recent polls found