Meta Programming System 2.0
Written by Mike James   
Tuesday, 23 August 2011

The beta 2.0 of JetBrain's open source Meta Programming System has been released and it's time to recognize its potential.

MPSlogo1

JetBrains is slowly but surely becoming more than just a purveyor of programming tools and widgets. Its recent foray into a new JVM language in the form of Kotlin is too young to see how it will fare in the rough and ready world of neonate languages, but its Meta Programming System is old and successful enough to have just been released in version 2.0 - and it is open source.

The first question is what is a Meta Programming System, MPS?

The glib answer is that it is a Language Oriented Programming system. More helpfully, it allows you to work in a Domain Specific Language DSL that you can invent as you go along. The core of the idea is language extensibility. You don't program by putting together lots of small commands; you program by inventing new commands. If you think for a moment you should realize that this is the long-term goal of all top-down modular programming approaches.

The system maintains a dynamic Abstract Syntax Tree which describes the rules of the language. In creating a language, you define the rules for code editing and rendering. You can also specify the language type-system and constraints. The system can use the syntax and type rules to verify the code that you write on the fly.

Of course all of this is just design on a par with UML, say, but the extra factor is the ability to use generators to convert the DSL into code in a language of your choice. Currently you can generate Java, XML, HTML, JavaScript and more, but MPS is particularly strong on Java. 

You don't have to start from a blank canvas, baseLanguage is the default that you can add to and modify to create your own DSLs and there are some standard DSLs you can load as starting points.

The new version 2 isn't backward compatible with version 1.5, but it comes with an update tool.  The new features are too many to list but the major improvement is an IDE for your DSL - essentially a customized version of MPS that only work with your DSL. You can also customize the make process to be appropriate to your language.  The type system has also been improved to make it easier to use and more powerful. Other new features of note include the ability to merge model's, annotations, you can paste Java code and it will be automatically converted to BaseLanguage and more - see the MPS website for the fine detail.

If you would like to get started with MPS then take a look at the tutorial and try to keep in mind what you are doing and its wider potential rather than the simple problem being solved which really doesn't need the approach. However this said I can think of real applications which are very similar to the tutorial and yes that simple!

Perhaps the most important thing about MPS is that it brings language extension within the grasp of the average programmer who isn't a language specialist. What it exciting about it is, once you understand the idea, is the sheer number of potential applications that suggest themselves, and some of them are so outside- the-box that the original inventors of the system would be surprised by them. You don't have to be committed to the DSL paradigm to get some value out of MPS.

You can  Download MPS from the website and generally join in with the MPS community. It is an open source project that is worth exploring.

 

mpslogo2

More Information

Kotlin - another Java alternative?

Language Oriented Programming article

Download MPS

MPS Tutorial

 

If you would like to be informed about new articles on I Programmer you can either follow us on Twitter or Facebook or you can subscribe to our weekly newsletter.

 

Banner


Falco On Track To Version 1.0.0
02/04/2024

Falco is a cloud native runtime security tool for the Linux operating system, designed to detect abnormal behavior and warn of potential security threats in real-time. Now it's about to release its fi [ ... ]



Deno Improves JSR Support
08/04/2024

Deno has been updated to improve JSR support, and to build on the Temporal API introduced in version 1.4.  Deno is the JavaScript and TypeScript runtime from the creator of Node.js.


More News

Last Updated ( Tuesday, 23 August 2011 )