Questions tagged [dsl]

Domain-Specific Language is a programming language intended for a particular application domain

A domain-specific language (DSL) is a programming language intended for a particular application domain.

Well-known examples that can be considered DSLs include for markup, for statistics.

There are three key points in above mentioned definition.

  1. Programming Language: DSL is a programming language, which is used by humans to instruct a computer to do something.
  2. Limited Expressiveness: DSL is not a general purpose language like C, Java, etc. It supports minimum features needed to support its domain. Programmer cannot build entire software system using DSL.
  3. Domain focus: DSL focuses on a small domain. The limited focus makes it easy to understand and easy to use.

Martin Fowler divides DSL mainly into two categories :

  1. A External DSL : it is a standalone language with its own custom syntax, but adopting other language such as XML syntax is common. Example of external DSLs are for database queries, languages.
  2. An Internal DSL : They are intrinsically embedded inside a general-purpose language, such as Lava (hardware description language on top of ), (build system on top of ), or (structured markup language on top of ).
2200 questions
13
votes
5 answers

Why is Ruby on Rails called a domain-specific language?

Recently, when I tried to explain why Ruby on Rails is a domain-specific language (DSL) to an intern at my organisation, I was not able to articulate my reasoning to the effect I would like to. Maybe I do not understand the space well enough to…
paddle42380
  • 6,921
  • 7
  • 32
  • 40
12
votes
4 answers

Writing a simple parser

I need to write a simple parser to a sort of Domain Specific Language. It needs to have basic arithmatics with proper operators evaluation order and a syntax to call functions of the underlying environment which can be overloaded. What is the…
shoosh
  • 76,898
  • 55
  • 205
  • 325
12
votes
3 answers

Groovy vs Scala for internal DSL

I am going to create an internal DSL for JVM. And I see that Scala and Groovy are the best candidates for this task. I found that Groovy script is less verbose, uses BigDecimal by default, while Scala has good type inference system. What are other…
Nutel
  • 2,244
  • 2
  • 27
  • 50
12
votes
1 answer

What is DSL in Scala?

Going through various Scala related material, term DSL is used at many places. Google search tells it is Domain specific language. What exactly it means, and why is it that this term doesn't comes across while learning other languages like Java?
Mandroid
  • 6,200
  • 12
  • 64
  • 134
12
votes
12 answers

Domain Specific Language resources

I was just listening to some older .Net Rocks! episodes, and I found #329 on DSLs to be interesting. My problem is that I can't find any good online resources for people trying to learn this technology. I get the basics of the creating new…
Eric Haskins
  • 8,505
  • 12
  • 38
  • 47
12
votes
2 answers

How to Create an Internal DSL in Scala?

I have been looking at a couple of books and resources on domain specific languages. I think I want to build an internal DSL in Scala. def instrument = new FXInstrument { provider = "EuroBase" instrumentOrders = List( new FXOrder…
peter_pilgrim
  • 1,160
  • 11
  • 18
12
votes
10 answers

Domain Specific Languages (DSL) and Domain Driven Design (DDD)

What is the differences and similarities between Domain Specific Languages (DSL) and Domain Driven Design (DDD)?
bovium
  • 2,869
  • 6
  • 25
  • 35
12
votes
6 answers

Is there any way to programmatically generate Python bytecode?

I want to hack around with the Python interpreter and try creating a small DSL . Is there any module where I can do something like this theoretical code (similar to LINQ expression trees)? expression_tree = Function( Print( …
Jason Baker
  • 192,085
  • 135
  • 376
  • 510
11
votes
3 answers

Syntax Highlighting tool/language that works with multiple editors

Is there any tool that would allow me to specify syntax highlighting for a given language, then generate syntax highlighting files for some of the more common editors? I ask because I'm developing a domain-specific language, and I'd like to provide…
simplyletgo
  • 151
  • 5
11
votes
6 answers

Embed python/dsl for scripting in an PHP web application

I'm developing an web based application written in PHP5, which basically is an UI on top of a database. To give users a more flexible tool I want to embed a scripting language, so they can do more complex things like fire SQL queries, do loops and…
Martin Hoegh
  • 465
  • 3
  • 17
11
votes
3 answers

How to enforce usage rules on Custom Kotlin DSL

Im investigating Kotlin DSLs following these examples:- https://github.com/zsmb13/VillageDSL Im am interested in how to enforce usage rules on all attributes exposed by the DSL. Taking the following example:- val v = village { house { …
Hector
  • 4,016
  • 21
  • 112
  • 211
11
votes
0 answers

Tagless final DSL with RValue LValue problems

Typed Tagless Final Interpreters are an interesting alternative to the free monad approach. But even with a quite simple ToyLang example in tagless final style ambiguous type variables pop up. ToyLang is an EDSL that should read something like…
mcmayer
  • 1,931
  • 12
  • 22
11
votes
4 answers

Use of Clojure macros for DSLs

I am working on a Clojure project and I often find myself writing Clojure macros for DSLs, but I was watching a Clojure video of how a company uses Clojure in their real work and the speaker said that in practical use they do not use macros for…
yazz.com
  • 57,320
  • 66
  • 234
  • 385
11
votes
6 answers

Libraries for converting physical units (kilograms, pounds) in Ruby?

I know Rails has some nice helpers for date and time management. Is there an already-working project consisting of, or incorporating a clean DSL for standard units and their conversions? Any project with helpers for the conversion between the two…
Joseph Weissman
  • 5,697
  • 5
  • 46
  • 75
11
votes
4 answers

Textual representation for UML class diagrams - DSL for UML

UML classdiagrams are a standard graphical notation to describe classes and their relationships. Is there a standard textual notation (DSL) to describe the same? Don't say XMI or EMF;-) I think you could do that with Corba IDL and use Interfaces for…
weberjn
  • 1,840
  • 20
  • 24