Channels ▼


Jetbrains Releases MPS Language Workbench

JetBrains has released Version 1.0 of MPS (short for "Meta Programming System"), a language workbench and IDE for extending existing languages and creating custom Domain Specific Languages. By using MPS and DSLs created with its help, domain experts can solve domain-specific tasks easily, even if they're not familiar with programming. MPS is freely available, with a major part of its source code open and available under the Apache license, and can be downloaded bug-tracking system, code-named Charisma, is developed entirely with MPS. This issue tracker is a modern Web 2.0 application. To create it, a whole stack of web application languages was created: languages for HTML templates, controllers, database access, JavaScript, etc.

Jetbrains describes MPS as an implementation of the Language-Oriented Programming (LOP) concept. LOP is a programming paradigm which adds another degree of freedom compared to traditional programming: the ability to create/extend/embed a language with which you write your programs. Most programs are written for specific domains: financial applications, web applications, games, IDEs, etc. In case of, say, a financial application, we might embed first class monetary values in a language; in case of a web application we might move such concepts as controllers or template to the language level, etc. For background on LOP, see Language Oriented Programming: The Next Programming Paradigm, by Sergey Dmitriev.

MPS doesn't use any parsers. It works with the abstract syntax tree directly, so it doesn't require any parsing. Compiler construction knowledge might be useful, but you don't have to be an expert in this field in order to use MPS: it contains a predefined set of languages with which users can create their own languages.

MPS provides a text-like projectional editor, which is used to write languages and programs. It is text-like enough to be learned really quickly. According to Jetbrains experience, it takes about two weeks to become productive with it. Despite the fact that this editor is text-like, there are some key differences with plain-text editors, but they are necessary to allow composing languages.

Language composability means that you can extend/embed languages in any combination. This promotes languages reuse. Languages become more like libraries in the Java world. Imagine that you are writing an application which uses a language for monetary values from one vendor, and a quantitative calculation from another. Since these are languages, you can achieve a much higher level of abstraction than with libraries, and because they are composable, you can reuse them as freely as you reuse Java libraries. You can read more about this in Konstantin Solomatov's article DSL Adoption with JetBrains MPS.

A projectional editor is an approach for editing an abstract syntax tree directly. For each node of the abstract syntax tree, a projection is created, which is a part of the screen with textual represention of the node. As the user interacts with the projection, changes are reflected in the node.

Jetbrains says its goal is to work with composable languages. Using a plain-text representation and grammars would present composability problems. Text-based grammars can be ambiguous and as a result, composed languages might not be deterministically parseable. Consider an example: Imagine that two parties decided to add string interpolation syntax to Java. String interpolation allows embedding of expressions inside of string literals. So, the first party might use the following syntax: ${expr} and the other might use {expr}. If you write the following code in Java, with both of these extensions added, it will be ambiguous: "Balance of your account is ${expr}". You don't know whether $is part of string interpolation syntax or part of a string literal. Of course, this example is quite artificial, but it is a good illustration of the problems which arise when we have different constructs with similar syntax in different language extensions.

MPS stores source code in its internal XML-based format. It isn't supposed to be edited directly. If you create a language, there are several options for distributing it. First, you can create a packaged version of your language and distribute it as a file. Second, you can create a special distrubutive of MPS which, in addition to the standard set of languages, will include your language. A third option, which is under development now, will allow you to create a stripped-down version of MPS, where particular parts of IDE will be removed or altered, so that you will be able to create a custom MPS-based IDE for your language.

MPS is a resource intensive application. To create simple languages, you will need a 2.0-Ghz CPU and at least 3-Gb of RAM. If you want to create a larger application, you will need a 2.6-Ghz CPU and at least 4-Gb of RAM (in such a case feel free to change the -Xmx option in mps.vmoptions file in the bin directory of MPS installation).

Related Reading

More Insights

Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.