Konstantin Solomatov's Weblog

Archive for April, 2008

MPS build #579 is out

Posted by Konstantin Solomatov on April 25, 2008

We released a new build. New features:

  • improved model properties dialog (automatic import of models/languages on module level)
  • devkits refactored
  • simplification of classpaths in modules
  • auto resolver
  • unit test runner
  • todo view and todo highlighting in mps
  • icons in plugin actions

As usual you can download it from here

Posted in MPS | Leave a Comment »

Simple Base Language Extension Screencast

Posted by Konstantin Solomatov on April 21, 2008

We have created a new screencast about MPS. This time it’s about a simple BaseLanguage extension. In it we not only show language extension but the features which are inaccessible in programming languages with metaprogramming support: custom type system and data flow analysis. You can watch it here

Posted in MPS | 1 Comment »

“The Simplest Language” screencast

Posted by Konstantin Solomatov on April 14, 2008

We’ve create a screencast on which you can see how to create a simple language in JetBrains MPS. You can find it here

Posted in MPS | 1 Comment »

MPS build #531 is out

Posted by Konstantin Solomatov on April 11, 2008

MPS build #531 is out.
Among new features and improvements:

  • Improved entering of code. Intelligent input mechanism is more intelligent. For example, it’s possible to enter System.out. without pressing control+space. When you press ” you will have a string where you can start typing just like in IntelliJ IDEA
  • Improved data flow language. All the baseLanguage constructs are checked with it.
  • Extract method refactoring (you can activate it in baseLanguage extensions from popup menu or with control+alt+M) shorctut.
  • As usual, you can download it from: http://www.jetbrains.net/confluence/display/MPS/JetBrains+MPS+Download+Page

Posted in MPS | Leave a Comment »

Updated “Getting started” how to for MPS

Posted by Konstantin Solomatov on April 10, 2008

One of our EAP users, Tracy Snell have update “Getting started” how to to the current state of MPS. You can find it here. We weren’t updating it because now we have better examples and screencasts which cover MPS’s features more thoroughly but anyway this example can be useful if you want to create simple working language in a short period of time.

Posted in MPS | Leave a Comment »

Data Flow Analysis In JetBrains MPS

Posted by Konstantin Solomatov on April 8, 2008

Data Flow analysis allows us to perform a lot of handy checks: we can find unused assignments, access to uninitialized variables, and it’s hardly possible to implement extract method refactoring without it. All in all, it dramatically improves experience of working with IDE. Of course we at JetBrains have implemented it in our meta-programming system and of course we created a language which can be used to describe data flow aspect of a language

In order to support data flow analysis in your language, you have to represent constructs of a language in terms of elementary instructions. Among them are:

  • read x – accesses variable x
  • write x – writes to variable x
  • jump p – unconditionally jumps to position p
  • ifjump p – conditionally jumps to position p
  • ret – return from current program

As you can see, these instructions are quite simple. It’s impossible to write a working program with them but for the kinds of data flow analysis we are interested in they are more than enough.

Let’s consider a simple example. Here is a code for do..while loop:

First we insert code for a loop’s body with “code for” statement. Then we insert code for condition. After evaluating condition, we perform conditional jump to the start of code for a while statement. Gray braces represent code which can be unreachable (we perform reachability analysis using these instructions graph). As you can see, this code is very simple and domain specific.

Let’s consider a more complex example: switch statement

First, we evaluate expression which value we switch on. Then we add conditional jumps to starts of case blocks. Finally, we add code for default case:

P.S. Almost all of this stuff is accessible in the latest build which you can download from here

P.P.S. You can read this post in Russian here

Posted in MPS | Leave a Comment »