LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-09-2013, 07:38 PM   #1
stateless
Member
 
Registered: Jan 2013
Distribution: Debian
Posts: 166
Blog Entries: 1

Rep: Reputation: 4
Domain Specific Language


If I wanted to create a small DSL to help manage a (custom) Linux system, what would be the easiest way to go about it? Is there some snazzy programming language out there just for making DSLs and their interpreters? Or maybe a module in another language that is super easy to use and figure out?

In my case, the DSL would center around managing system allocation resources (e.g, "allocate 1000 hours to project xyz") and accounts (e.g., "create project xyz") and have the interpreter execute the correct shell commands or database procedures.

My background is in FP languages, but I'm open minded here to whatever involves the least amount of work.
 
Old 07-10-2013, 02:39 PM   #2
ta0kira
Senior Member
 
Registered: Sep 2004
Distribution: FreeBSD 9.1, Kubuntu 12.10
Posts: 3,078

Rep: Reputation: Disabled
You might be better off writing a library or an extension for an existing programming language. I know that in Python, among other languages, you can fill the global namespace with functions and objects, then interpret an arbitrary file within that namespace. This allows you to encapsulate the program logic in Python or C, and load snippet files that access program hooks. The snippets can merely be a series of function calls that can be written by someone with minimal programming experience, since Python has a minimalistic syntax. At the same time, it also allows you to iterate over a list if you have a lot of repetition. The persistent state allows you to modularize the setup, e.g. set up accounts in one snippet file and allocations in another, so you can use "inert" accounts for testing purposes while you make sure your allocations work properly.

I've used this as a cheap way to incorporate a configuration parser and run-time extension framework into an existing C++ application, but you can certainly do it entirely in Python. And, as others will invariably point out, Python is just one of many options.

Kevin Barry
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Fonts - Is Specifying A Font For A Specific Language Or Script Possible? RASCRanasingha Linux - General 3 03-13-2011 06:47 PM
Blocking mail to specific domain from specific user orko Linux - Server 0 03-26-2009 02:18 PM
How to force specific domain or user specific emails to proces in sendmail 8.13.5 FC5 peanutsa Linux - Newbie 1 03-22-2009 05:33 AM
Bouncing specific domain with specific message dlublink Linux - Software 1 08-21-2006 02:29 PM
Non ASCII (language specific) characters in filenames? milicic.marko Linux - General 2 03-19-2005 05:15 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:30 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration