Language design patterns: Inline definitions

Language users will often want to write certain definitions that are later reused elsewhere in their models. For example, a user might define an entity, listing its attributes and references to other entities, or a UI component, such as an address form or a search form. Many of these definitions are best written separately from their usages. You first define an entity and then have other entities link to it. Or you create a form first and then refer to it from some action code....

Debugging in MPS

What do you do when your MPS language compiles and builds with no errors but behaves unexpectedly? Menu items you want to see don’t show up, the type system shows a strange error that comes from nowhere, or the generator produces unexpected output. In a “classic” development situation, this would be the point where you would start your program under a debugger or add some print or log statements. But how do you debug your MPS language?...

Logging in MPS

MPS offers several logging mechanisms suitable for different use cases and different users. Logging to the Messages tool window You can have your messages appear in the Messages tool window, looking like this: Logging to Messages tool window To log a message: Import the jetbrains.mps.baseLanguage.logging language into your model using Import Language action (Ctrl+L/Cmd+L). Add message statements (message error, message info, etc.) to your code. Provide the current project if possible....

Debugging MPS Remotely Using IntelliJ IDEA

When MPS behaves unexpectedly and simple attempts to pinpoint the cause fail, it may become necessary to go deep and unleash the power of a full-blown debugger on the generated code. MPS being a Java application, it is possible to debug it remotely. The configuration involved is non-trivial, however, and this article will show you how to set up remote debugging step-by-step using IntelliJ IDEA Community Edition. Note that the term remote debugging doesn’t necessarily mean debugging from another computer....

Want to receive MPS tips directly in your inbox? Leave your e-mail address below.