Wednesday, March 26, 2014

Jet brains MPS


Hello there readers. It’s been a long time since I could pull up some time to write a proper post. Well anyway I’m back with a bang, more determined than before. I’m planning to renovate my website sometime soon and if you have any specific design please let me know. Well coming to the topic of the day, Jet brains MPS for creating DSL (Domain specific language). Some of you may already know about DSL while some of them would be using it without knowing. Since it is an introductory tutorial I’m very much comfortable even if you have never heard about DSL at all.


DSL is also called as domain specific languages. As the name suggests it is domain specific i.e. it is used for specific purpose rather than for general usage. You may have heard or came across programming languages such as C++ Java. Such languages have been used for general purpose to develop various programs and applications and are collectively known as General purpose languages (GPL).  DSL may bolster existing GPL or may be used to create a programming language on your own. Jet brains MPS is a language workbench (Language factory) to achieve the same. Among the different development tools Jet brains MPS is famous due to two reasons. First, it is open source software i.e. you can download the code, play on your own or maybe contribute to the community by creating a cool add-on feature. It also has a forum where people are so friendly that they can help you with anything. Second, it uses projectional editing i.e. developing a programming language may involve various phases and you can have control over various intermediate components/outputs of various phases. This necessarily means that you will have full control of what you are developing and you can very easily debug due to the in depth analytic capability of the projectional feature of MPS.

Every complicated concept starts with a simple example. We will start by creating a DSL for generating a calculator. This example is like Hello World of Jet brains MPS.
So essentially when you enter:
 calculator MySalary
 input PHP Hours
 input Java Hours
 output Java Hours*10 + PHP Hours*5
You get::



See now using this DSL you can create as many as calculator as you wish according to your need without the need to use complex programs to achieve the same. One important thing about DSLs is that you can always add a new command if needed and the language becomes robust and sustain in the longer run. If you want to get started refer this link https://www.jetbrains.com/mps/docs/tutorial.html.
If you want to me to do the tutorials I will be more than happy to do so. If you have any queries or suggestions or feedback please let me know.

Stay tuned for more.

0 comments:

Post a Comment