MPS is a rather unique tool and as such it has its own terminology which can be ambiguous and confusing sometimes. Today I want to talk about two terms that newbies often mix up, namely modules and models.

When asking a question related to MPS it helps to use these terms properly, so that your question is easier to understand and answer. Understanding the distinction also helps when you need to understand a cryptic error message.

An MPS project contains modules. There are four kinds of modules: languages, generators, solutions, and devkits.

All modules except devkits contain models. A model then contains nodes.

Both models and modules can have various kinds of dependencies between them:

  • A model can import another model,
  • A model can contain concepts from a certain language. It is then said to use that language.
  • A module can depend on another module. This allows models in the first module to import models from the second.

Specific kinds of modules can have richer dependencies:

  • A language can extend another language.
  • A language can specify a solution as its runtime.
  • A generator can also extend another generator.
  • … and more.

The MPS generator processes each model separately. This is necessary as each model can have its own set of used languages and engaged generators.

The MPS build scripts are written in terms of modules and their dependencies and don’t concern themselves with individual modules.

When MPS compiles a given module, it then loads it. The entire module is loaded and one classloader is created per module.

However, in the “source” form MPS is able to load and unload individual models. Splitting your nodes between multiple models may help performance.