JetBrains MPS 1.1: Performance Improvements and Easier Debugging
Half a year ago, Meta-Programming System (MPS) version 1.0 was released by JetBrains. Following up on this, the upgrade to version 1.1 occurred in December. InfoQ revisited the current state of the language workbench, which is provided as an open source product under an Apache 2.0 license (with the exception of the JetBrains IDE framework, which was extracted from IntelliJ IDEA and which is not open source).
MPS already contains many of the building blocks for getting started with the tool:
- A base language (based on the Java language) that is already extended (with closures, collections, dates, regexp) and can be customized further
- The ability to modularize and compose languages out of specific parts
- Version control integration (subversion, git and any VCS supported by IDEA)
- An API to interact with the internal MPS model (e.g. to import content from external sources)
- The ability create additional type system definitions
- Tools to perform data flow analysis on the created languages
To get a better understanding of the actual state of MPS, InfoQ asked Markus Völter about his recent experience. Völter published a Software Engineering Radio Episode on MPS and recently worked with JetBrains' Konstantin Solomatov to evaluate MPS as production ready language workbench. Asked for the most enjoyable features of MPS, Völter said:
The ability to easily modularize, extend and compose languages. One DSL is usually not enough. You have to be able to combine (by reference, and syntactically) a set of languages. MPS allows this seamlessly.
Völter also discussed the productivity aspect of working with MPS:
MPS is very well integrated. Provides support not just for language structure and syntax, but also for type systems, quick fixes, runtime support and transformations.
In addition to evaluating MPS and providing screencasts such as an example of extending the base language with a
lock statement and generating Java code from that, Völter is also in the process of creating a new language within the tool:
I am currently working on a set of language modules for embedded software development based on C. The extensions include state machines, components, feature variability and safe code. I am working on a proof-of-concept based on OSek on Lego Mindstorm robots.
The current 1.1 release of MPS contains a number of improvements:
- The performance and memory consumption were optimized
- Debug information added by a generator allows for easier error tracing and stacktrace analysis
- Multiple execution profiles can be saved and used like in other IDEs
- An ant task for running the generation workflow is provided, so that use within Continuous Integration environments is possible
Getting Started with MPS
It takes some time getting used to the tree editor (JetBrains says about one to two weeks). Especially important is understanding the existing structural elements of MPS, because one should know what can be defined where and why. Although the completions, error messages and intentions help a lot, an understanding how the syntax trees are structured for the different aspects of a language is very important.
Familiarity with the domain of parsers, syntax trees, grammars, language definitions and such certainly helps one to better understand the concepts of MPS.
The online calculator-building tutorial only offers a cross-cutting insight of what is possible and how to achieve it. The screencasts by Markus Völter are a more comprehensive example for extending a language. Everyone working with MPS should read the users guide and discussion forums as they contain much valuable information, and Jens Nerche also provides a collection of sample MPS projects on github that explore how different concepts are achieved with MPS.
Jetbrains used MPS to build its own Issue Tracker (YouTrack) and is very likely to create more applications using MPS. It will be interesting if and when the first IDE's with projectional tree editors will be released to the software development community.
A debugger feature is currently worked on, that will allow stepping through the code in all abstraction levels from defined language to the generated code currently running. This will made be possible using the provided debug and backtracking information that is produced along the language generation process.
JetBrains is also aiming to provide support for custom persistence managers for the defined syntax trees. Storing the nodes in XML and the VCS' provided is just one option. Customizable persistence is planned for one of the next versions. Then the possibility of storing the AST in a custom format (even as text) persisting it e.g. in a graph database (like neo4j) will be available.
Laurie Williams and Catherine Louis Nov 28, 2014
Edmund Jorgensen Nov 27, 2014
Lisa Adkins and Michael Spayd Nov 27, 2014