MPS

How Does MPS Work?

The major goal of MPS is to allow extending languages. This is because every existing language already has a strict language syntax defined, which limits its flexibility.

The problem in extending language syntax is mainly the textual presentation of code. This is especially true if we want to use different language extensions, where each one may have its own syntax.

This naturally leads to the idea of non-textual presentation of program code. A major benefit of this approach is that it eliminates the need for code parsing. Our solution is to have code always maintained in an Abstract Syntax Tree (AST), which consists of nodes with properties, children and references, and fully describes the program code.

At the same time, MPS offers an efficient way to keep writing code in a text-like manner.

In creating a language, you define the rules for code editing and rendering. You can also specify the language type-system and constraints. This allows MPS to verify program code on the fly, and thus makes programming with the new language easy and less error-prone.

MPS uses a generative approach. You can also define generators for their language to transform code in the custom language to compilable code in some conventional language. Currently, MPS is particularly good for, but is not limited to, generating Java code. You can also generate XML, HTML, JavaScript, and more.

MPS for Creating DSLs and Language Extensions

MPS originally includes a ready-to-use universal language called BaseLanguage, which can itself be used to create programs. However, the right way to use MPS is to extend BaseLanguage and create new languages. MPS comes with several helpful extensions to BaseLanguage for working with strings, collections, dates, regular expressions, etc. You can also use them as a reference for creating new languages. These powerful tools make MPS quite proficient as an instrument for creating Domain Specific Languages (DSL).

MPS for Using DSLs

You can define custom language editors and other constraints for any new language, so that working with those DSLs becomes really simple. Domain experts who are not familiar with traditional programming can easily work in MPS with their domain-specific languages using domain-specific terminology.



Download MPS, give it a try with the help of the supplied Tutorial and let us know what you think.