Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: it's scripts all the way down!

by perlfan (Curate)
on Mar 16, 2016 at 15:00 UTC ( #1157944=note: print w/replies, xml ) Need Help??


in reply to it's scripts all the way down!

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.

HTH

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1157944]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2020-05-27 00:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    If programming languages were movie genres, Perl would be:















    Results (152 votes). Check out past polls.

    Notices?