Hot answers tagged dsl
15
Read On Lisp and then decide for yourself.
My summary is that Ruby is better at providing convenient syntax. But Lisp wins, hands down, at the ability to create new abstractions, and then to layer abstraction on abstraction. But you need to see Lisp in practice to understand that point. Hence the book recommend.
13
Ruby's facilities for DSL authoring don't change the nature of the language. Ruby's metaprogramming facilities are inherently tied to Ruby syntax and semantics, and whatever you write has to be shunted into Ruby's object model.
Contrast that with Lisp (and Scheme, whose macro facilities differ), where macros operate on the abstract program itself. Because a ...
9
You can try ANTLR
(or ANother Tool for Language Recognition) a parser generator that is among others available for dotnet. In the community you can find definitions for sql, c# and many other languages.
According to google there is also ide support:
ANTLRWorks: The ANTLR GUI Development Environment
Eclipse plugin
8
You are overlooking the obvious fact that not all database platforms accept the same SQL syntax, so embedding SQL statements throughout your application just won't work for every database platform. If you ever need to support multiple database platforms, you will have to rethink most (if not all) of these SQL statements.
7
The most fundamental problem of common SQL use is, that SQL queries are strings, that are somehow composed from another language. This is where SQL injections and other vulnerabilities and WTFs come from (your example is quite poorly chosen, because your query doesn't actually have any parameters).
The next problem is actually a corollary: if you just have ...
6
I would recommend creating your DSL on top of an existing language (internal DSL). I've done this a few times with Python, creating systems where the consumer of the DSL writes a python file that is used as a configuration file for the system. The configuration file uses constructs (classes, functions) that I have defined. These constructs form the DSL.
...
6
The easiest way to go is a fluent interface. This requires no tools at all, and gives you great IntelliSense support, but you still have to write things in a .NET-kinda way, such as
Mix.Paint(Color.Green).With.Paint(Color.Red);
Alternatively, you can write beautiful DSLs in Boo. There is an entire book on that subject.
5
This depends on the complexity of the domain. If it mainly consists of structured data, a visual editor may be more intuitive to use, but if the domain contains significant amounts of logic, experience has shown time and time again that visual editors are a poor tool for that.
Additionally, there are some very common, very useful tasks that are trivial with ...
5
Your thinking is still too low-level. You're looking for a better way to say things like "What's the value of O2 detected by O2 Sensor #2?" But why do you need to know that value? What are you going to do on the basis of the value?
If you just want a wrapper that's a bit less cumbersome, sure, write that. But if you want a genuine domain-specific ...
5
To answer the question of whether CSS is a domain specific language, according to Martin Fowler, it is. In fact he lists it among examples of DSLs.
You do have to understand that talk about DSLs has been going on for a while now, and Wikipedia's more narrow definition has come along much later in the discussion. Understand that Wikipedia is edited by ...
4
I have not read it, but I'd recommend the book by Martin Fowler on the subject "Domain Specific Languages". Many of his other books have proven to be very insightful and helpful in my thinking about software development. And I expect the DSL book to be as much so (it is on my to read list).
http://martinfowler.com/books.html
4
This is an indirect answer to your question. In 1982 I wrote the first commercial C source-level debugger, CDB (also possibly the first remote debugger, kernel debugger, and multi-process/multi-thread debugger). I initially wrote it because I needed it (the only other option was sdb on a VAX, except I didn't have a VAX, and sdb sucked planetoids). This ...
3
What makes sense to you? After all, it is your product and you can do with it as you please. The real question is this: will there be any reward for your work? You'll end up with two variants to support and if you introduce features they may not be compatible with each style (in a nice way).
If it was up to me, I'd stick with the lisp like syntax but that ...
3
That's still too verbose for my taste, because of the lack of encapsulation. I don't know much about your topology, or the overlap of commands between sensors, but my first choice for an API for your examples would simply be:
ReadFirmwareVersion(1);
ReadO2(1, 2);
If you needed it to be more object-oriented, and not have to pass around the controller and ...
3
No
In software development and domain
engineering, a domain-specific
language (DSL) is a programming
language or specification language
dedicated to a particular problem
domain, a particular problem
representation technique, and/or a
particular solution technique. [wiki]
CSS is neither programming language nor specification language. CSS ...
3
The best language I'm aware of specific to text search and processing is awk. If awk doesn't meet your needs, it's likely nothing will unless you create it yourself.
However, if you do need to make your own, you don't need to start completely from scratch for each language. You can use a tool like antlr that can be exported to various languages, or build ...
2
Joel had written nice article 10 years ago: Don't Let Architecture Astronauts Scare You
I think it's exactly the case. I was using abstraction layer in my own applications since I found a patterns and it was easy for me to do this way. But it was my DAL I knew every single line in source code => full control. But I would not suggest to use that framework ...
2
Look at Xtext (http://www.eclipse.org/Xtext/) and Xbase (http://blog.efftinge.de/2010/09/xbase-new-programming-language.html). If the users are non programmers I don't think you should base your DSL on an existing programming language. It will be too complicated for them. A "clean" DSL can be very efficient if made correctly.
2
Is it a DSL? Yes.
Should you put it in your resume as such? No!
You're debating it (since you're asking the question here). If you're debating it, or more importantly, if you think a potential employer will debate it, why bother? What's the upside?
Do you believe that an employer will say "I don't like that he puts DSL and CSS in the same context and ...
2
I disagree that CSS can be called a domain specific language.
Normally with a DSL what you would call the "domain" is a business domain, not a technical domain. A DSL defines keywords and constructs that indicate entities specific to the business. The goal is to make it easy for people who are experts in the business domain to use the DSL.
CSS is a ...
2
I would prefer to write
machine1.Controllers[1].O2Sensors[2].ReadO2();
There is no need to have a SendCommand in there.
UPDATE
Here is my suggestion for a controller class
public class Controller
{
private const int ReadFirmwareVersionCmd = 71;
private const int PassThroughCommandCmd = 200;
private int _controllerNumber;
public ...
2
In designing language syntax, you have such a wide range of choices that it's really a matter of taste, not engineering. If you want a tried, tested, and familiar syntax, rip off a language or three of your choice. If you want to explore and invent something new, the range of potential pitfalls is also so wide that existing examples may not help.
There's ...
2
I will be the contrarian and point out that DSLs are often recommended inappropriately, because they are a more natural and flexible interface for programmers, and programmers like to create systems that are easy for themselves to use.
That means DSLs are best suited for features designed for programmers or highly trained and specialized users like IT ...
2
Your first question - what is a domain specific language... because this is too big to fit in a comment.
A domain specific language is a language that is designed to work within a particular problem domain. For example, within the Unreal engine (used for first person shooters), there is a domain specific language called UnrealScript that allows one to ...
2
Yes, DSLs are often implemented using other languages. Tcl, ruby, groovy, and many others are very good for creating DSLs. A simple DSL can be developed in a matter of just a few hours or days in many cases.
A lot depends on he "D" -- the domain. If you're writing a DSL for financial traders, you might write it in C to get high performance. If you're ...
1
This site may be interesting for you: http://nemerle.org . It's language for .net platform with rich metaprogramming features. More recently, the project is under the wing of the JetBrains: http://blogs.jetbrains.com/dotnet/2012/06/jetbrains-and-nemerle/ .
1
If you mean DSL in strict terms, as in a programming language spec restricted to only one domain, then yes. The proliferation of the JavaScript/ECMAScript engines actually increases their viability - given a common virtual machine which is as flexible as the ECMAScript ones tend to be, DSL are both much easier to create, and likelier to be encountered.
What ...
1
Practical Common Lisp goes through details of designing several DSLs. Something on denotational semantics and languages in general might add a bit of necessary understanding.
There are no widely accepted "best practices" and methodologies yet - it is still pretty much an art, so the best way of learning is by example of existing successful implementations, ...
1
Learning a new syntax is not a big deal. However, by syntactic similarities, you associate yourself strongly with other languages in that field- even if your semantics are different, you will have a tough time showing people that they aren't that similar. C syntax is about the only syntax that doesn't have this problem, because when compare for example C to ...
Only top voted, non community-wiki answers of a minimum length are eligible