Публикации и ответы на комментарии в блогах JetBrains не выходят на русском языке с 2022 года.

Приносим извинения за неудобства.

Interviews

Интервью с Артёмом Тихомировым, Senior Java developer в проекте MPS

Hi Artem! Tell us a little bit more about yourself and what you are doing at JetBrains.

My name is Artem Tikhomirov and I am working on the MPS project, the JetBrains DSL Development Environment. I have over 15 years of experience in the field of modeling tools, contributing to all kinds of projects, both open source, and commercial.

Artem Tikhomirov

Can you describe JetBrains MPS in a few words?

JetBrains MPS is a tool used to create your own domain-specific languages (DSL). A DSL expresses your domain processes and knowledge in a language using the concepts of your particular industry. This way, people from that field, domain experts, can work with that language that was created tailored for them. Which means that you write in the language that you have created and the tool will generate the equivalent code of a specific programming language.

I saw “Projectional editor” in the name of the talk. What does it mean?

A projectional editor allows the user to efficiently edit the abstract syntax tree (AST) representation of the code. It can mimic the behavior of a text editor for textual notations, a diagram editor for graphical languages, a tabular editor for editing tables, and so on. The user interacts with the code through intuitive on-screen visuals.

Can you give an example of a DSL?

The most popular and widely adopted ones are HTML and SQL, but there are many others that aren’t that popular – they target a particular programming niche or are being used internally within a company. We had two interns create a DSL for an interactive voice response (IVR) system. The IVR is the recording you hear when you call a company and you have to choose the correct option for a specific action. They created this DSL so that any of the receptionists could use it to generate Java, XML, and HTML, which they otherwise would not know how to write. We have now implemented it in our own company’s voice system, so that they could really contribute.

What are the main benefits of using a DSL instead of any other programming language?

The main advantage is the increase in productivity. You automate repetitive tasks by generating code to take care of them. A DSL has a higher level of abstraction, which means that the computer complexity is lower. By separating high-level models from concrete implementation, we open the doors to involvement from domain experts and a way of preserving the domain knowledge in the DSL.
Having a lot fewer bugs is also a benefit of using a DSL, due to shorter code, higher abstraction level and less boilerplate code.

What is the MPS approach to language development?

MPS comes with a set of what we call ‘language aspects’. These aspects include structure for AST/meta-model and constraints to restrict structures. MPS typesystem declares their own types. Generator transforms models and textgen aspect to produce code in a well-known text form, which is further compiled with regular compilers or processed otherwise (e.g. XML). MPS is also an IDE, so it offers tools like find usages, UI actions, context assistant tools, editor intentions, code data flow analysis, model migration, version control integration and much more. MPS keeps everything in models, which are edited, analyzed, transformed and persisted. There’s no text to mess with. Both language designers and end-users deal with models. Language designers edit models to define their languages. End-users write their programs in a language/set of languages provided by a Language Designer and perform actions the LD made available to them. It’s not necessarily code generation; we’ve seen applications that perform different types of data analysis, like robustness, fail-safety checks, and so on.

Are there competitors and similar solutions?

Some examples are the Eclipse modeling framework (EMF), xtext, Spoofax.
Certain aspects are covered by distinct tools (i.e. there are M2M tools, M2T tools, different approaches to build a typesystem) but none of them come with a seamlessly integrated set of these. Alternatively, to highlight some technical aspects, like Most language workbenches would end up with an abstract syntax/meta-model specification, transformation of ASTs (aka M2M) and code generation (M2T). Sometimes you can find support for own types, to specify constraints against an AST.

What industries benefit the most from using DSLs?

We have clients using DSLs for many different industries. Some examples are automotive, finance, insurance, and embedded systems.

What makes MPS stand out among similar tools?

MPS is a powerful tool that has a complete language development stack, full-fledged IDE support, model transition/migration, and deployment history. As I mentioned before, Projectional editing is one of our biggest assets, which gives users the freedom to truly combine & mix different languages. MPS is backed up by a commercial company with a long track record of successful tool development. This gives us the reliability and confidence to focus on building a tool that is revolutionizing the way programming is done today.

Thank you very much for your time, and we can’t wait to see your presentation "Create a programming language that the whole company can understand!"

Впервые опубликовано на сайте secrus.org.

Discover more