Child pages
  • MPS User's Guide
96 more child pages

Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.

 You are viewing documentation of MPS 2018.3, which is not the most recently released version of MPS. Please refer to the documentation page to choose the latest MPS version.


MPS User Guide for Language Designers


Welcome to MPS. This User Guide is a complete reference documentation to MPS and it will navigate you through the many concepts and usage patterns that MPS offers and will give you a hand whenever you need to know more details about any particular aspect of the system.

Beginner's Fast Track to MPS


Here's our offer for new comers: Try our Fast Track to MPS tutorial, which was designed specifically for IT professionals, who are completely new to MPS and prefer a guided tour through the MPS landscape. You will walk the beaten path one step at a time, following clear marks that show you where to go next. The information is structured so that you progress from simpler concepts to the more involved ones and at the end of the journey you'll understand MPS and will be able to use it effectively on your projects. Then you can come to this User Guide for more detailed and structured information.

Other useful documentation sources


A PDF version of the User Guide


For your convenience, you can also view the user guide in PDF created by Marco Lombardo.


  1. Fundamental knowledge - a high-level overview of the basic notions
  2. Using MPS - get familiar with the interface through which you'll communicate with MPS
  3. Language definition - defining a language involves specifying several aspects, each of which codifies some part of the language - the allowed AST structure, the appearance on the screen, type-system rules, etc.

    Aspect name


    Core documentation

    Other links


    Defines the kinds of nodes (called Concepts) that may be used in user models. Each node in the program (model) refers to its concept. Concepts specify, which properties, children and references nodes may have. Concepts can extend other Concepts and implement ConceptInterfaces.


    SModel language
        - programatic access to the model
    Open API
        - API reference for accessing models
        - building AST snippets
        - language for pattern matching nodes
    Using model & module dependencies from code FAQ

    Video - Introduction to JetBrains MPS, part 1: Projects

    Video - Introduction to JetBrains MPS, part 2: Structure


    Restricts the relationships between nodes as well as the allowed values for properties beyond the rules defined in Structure.

    Constraints typicaly define:
     - the target scope for references (a collection of allowed nodes a reference can point to)
     - situations, in which a node can be a child/parent/ancestor of another node
     - allowed values for properties
     - property accessor methods (getters and setters)



    Video - Introduction to JetBrains MPS, part 3: Constraints


    Just like classes in OOP hold methods, Concepts may define methods and static methods that can be invoked on nodes in a polymorphic way. Nodes thus carry behaviour alongside their properties and relationships.


    Video - Introduction to JetBrains MPS, part 4: Behavior


    Instead of defining a parser that would translate code from an editable form (i.e. text) into the tree-like structure that a computer could manipulate, MPS offers the concept of projectional editor, which let's the user edit the AST directly. The Editor aspect enables language designers to create a UI for editing their concept concepts.

    Diagramming Editor
    Transformation Menu Language
    Context assistant
    Context actions tool

    Editor cookbook
    Editor language generation API

    Video - Introduction to JetBrains MPS, part 5: Editor


    The Actions aspect provides means to specify advanced editor behavior, such as copy/paste or node initialization.

    Editor Actions

    Video - Introduction to JetBrains MPS, part 6: Actions (obsolete)


    All modern IDEs assist developers with instant code manipulating action available under a handy key-shortcut (Alt + Enter in MPS). Language authors can define such little code transformations for their languages in the Intentions aspect.


    Video - Introduction to JetBrains MPS, part 7: Intentions


    Models written in one or more languages get ultimately translated into runnable code in some target general-purpose language and platform, such as Java. Along the way models get gradually transformed so that repeatedly concepts get replaced with concepts from a lower level of abstraction until the bottom-line level is reached. The rules for translating concepts and their proper ordering is defined in the Generator aspect.


    Generator Plan

    Generator cookbook
    Building an interpreter cookbook
    Video - Introduction to JetBrains MPS, part 8: Generator


    During code generation after the Generator has reached the bottom-line AST representation, the TextGen phase kicks in and translates all nodes in the model into their textual representation and saves the resulting textual source files on disk.


    Video - Introduction to JetBrains MPS, part 9: TextGen


    The ability to understand the flow of values and the flow of control through language constructs helps languages report issues such as unreachable code or potential null-pointer error. Language designer can leverage the Dataflow aspect to define the flow for each concept, which MPS will then use to calculate the dataflow for the whole program.


    Dataflow cookbook
    Video - Introduction to JetBrains MPS, part 10: Dataflow


    Language that need to type-check their code need to provide type-system rules. The MPS type-system engine will evaluate the rules on-the-fly, calculate types for nodes and report 
    errors, wherever the calculated type differs from the expectations. 
    So called checking rules may additionally be defined to verify non-typesystem assertions about the model.


    Typesystem cookbook
    Video - Physical units extension

    Using the typesystem
    Debugging the typesystem 
    Video - Introduction to JetBrains MPS, part 11: Type-system


    Modern IDEs allow the developer to seamlessly and flawlessly change the structure of their code through refactoring. MPS allows the language designers to prepare such refactorings and make them part of their languages.




    When a new version of a language is released to the public, projects that use the previous version of the language must be migrated so that they use the new language constructs. Migration scripts, prepared by the language authors, will manipulate user code and automatically update it to the most recent version of the language.


    Migrations with branching


    Various aspects of language definition can be automatically tested. Language authors may create tests that will verify that the editor, actions, type-system, data flow or constraints of their languages behave according to the specifications.





    The Accessories Models can be stored at two places - either as an aspect of a language (recommended), or as a regular model under a solution. In both cases, the model needs to be added to the Language Runtime Language Settings so as it could be used. A typical use case would be a default library of Concept instances to be available at any place the language is used.







  4. IDE Integration - how to customise MPS, add language-specific visual extensions, use different persistence format, etc.
  5. IDE tools - tools that MPS offers you to manipulate the languages
  6. Platform Languages - out-of-the-box languages ready for use
  7. Building MPS projects - building languages from the command line, Ant integration, continuous integration, creating and using plugins, obfuscating code
  8. Cookbooks - quick how-to guides (pdf variant)
  9. External tutorials and guides



Did not find the answers?
Post your questions to our discussion forum