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
20
votes
2 answers

How can I recover sharing in a GADT?

In Type-Safe Observable Sharing in Haskell Andy Gill shows how to recover sharing that existed on the Haskell level, in a DSL. His solution is implemented in the data-reify package. Can this approach be modified to work with GADTs? For example,…
tibbe
  • 8,809
  • 7
  • 36
  • 64
19
votes
3 answers

Resources for learning how to design good API wrappers in ruby

I'd like to learn how to design good API wrappers in ruby. I'm looking for: blog articles tutorials best code and library to learn from the code directly (well commented and designed) books ... and also, what are some of your favorite API…
Luca G. Soave
  • 12,271
  • 12
  • 58
  • 109
19
votes
5 answers

DSLs (Domain Specific Languages) in Finance

Has anyone worked with DSLs (Domain Specific Languages) in the finance domain? I am planning to introduce some kind of DSL support in the application that I am working on and would like to share some ideas. I am in a stage of identifying which are…
Gustavo
  • 931
  • 1
  • 13
  • 25
18
votes
4 answers

How can I query elasticsearch for only one type of record?

I am issuing a query to elasticsearch and I am getting multiple record types. How do I limit the results to one type?
rjurney
  • 4,824
  • 5
  • 41
  • 62
18
votes
1 answer

Understanding method_added for class methods

I would like to do some magic in the moment instance and class methods are added to some class. Therefore I tried the following: module Magic def self.included(base) base.extend ClassMethods end module ClassMethods def…
GeorgieF
  • 2,687
  • 5
  • 29
  • 43
18
votes
7 answers

Scala - URL with Query String Parser and Builder DSL

In Scala how do I build up a URL with query string parameters programmatically? Also how can I parse a String containing a URL with query string parameters into a structure that allows me to edit the query string parameters programmatically?
theon
  • 14,170
  • 5
  • 51
  • 74
18
votes
12 answers

For what kind of problems do you write a DSL?

I'm just curious about Domain-Specific Languages. I have seen them several times in articles, and it seems that they can be used outside assurance or bank data definition problems. So I come to SO to have some concrete input. Did you ever use a…
Antoine Claval
  • 4,923
  • 7
  • 40
  • 68
17
votes
2 answers

Custom Java query class (DSL): Builder pattern, static imports or something else for complex queries?

I am creating a custom query class, and i am unsure about the most elegant way to code it. The goals are: Easy to use Extensibility Flexible so that complex queries can be formulated Approaches Currently i can think of two alternatives. 1.…
Alp
  • 29,274
  • 27
  • 120
  • 198
17
votes
6 answers

Pros/cons of different language workbench tools such as Xtext and MPS?

Does anyone have experience working with language workbench tools such as Xtext, Spoofax, and JetBrains' MPS? I'm looking to try one out and am having a hard time finding a good comparison of the different tools. What are the pros and cons of…
josh
  • 9,038
  • 8
  • 31
  • 37
17
votes
6 answers

What would the best tool to create a natural DSL in Java?

A couple of days ago, I read a blog entry (http://ayende.com/Blog/archive/2008/09/08/Implementing-generic-natural-language-DSL.aspx) where the author discuss the idea of a generic natural language DSL parser using .NET. The brilliant part of his…
kolrie
  • 12,562
  • 14
  • 64
  • 98
16
votes
3 answers

Are there any javascript frameworks for parsing/auto-completing a domain specific language?

I have a grammar for a domain specific language, and I need to create a javascript code editor for that language. Are there any tools that would allow me to generate a) a javascript incremental parser b) a javascript auto-complete / auto-suggest…
franck102
  • 161
  • 1
  • 3
16
votes
4 answers

What is a good parser generator for php?

I need to parse a small 'mini language' which users can type on my site. I was wondering what the counterparts of lex and jacc or antlr are for the world of php.
Toad
  • 15,593
  • 16
  • 82
  • 128
16
votes
3 answers

Elasticsearch the terms filter raise "filter does not support [mediatest]"

my query is like this: { "query": { "filtered": { "filter": { "bool": { "must": [ { "term": { "online": 1 } }, { "terms": { …
gwecho huang
  • 579
  • 2
  • 6
  • 13
16
votes
8 answers

Domain-specific languages vs. library of functions

This may be subjective, I don't know: I have this problem, which I'm kind of equating to the "what language for this project?" question, since I can't seem to solve it. I've been commisioned to write a book about a certain domain (let's say a very…
Dervin Thunk
  • 19,515
  • 28
  • 127
  • 217
16
votes
3 answers

Temporary namespace/context in Haskell

In Io, you can set the execution context using do: Http := Object clone Http get := method(uri, ("") println) Http delete := method(uri, ("") println) Database := Object clone Database…
Snowball
  • 11,102
  • 3
  • 34
  • 51