JetBrains MPS Documentation

repository·master·Indexed 23 days ago

https://github.com/jetbrains/mps

A meta-programming platform for designing Domain Specific Languages (DSLs) with full development environments, including editors, completion, and type checking. The platform uses generators to compile DSLs into target languages such as Java, C, or XML. This documentation covers building MPS from source using IntelliJ IDEA, configuring the Model Context Protocol (MCP) for coding agents, and a variety of sample projects demonstrating language definitions, custom aspects, generators, and debugger integration.

Tokens
18.2K
Snippets
15
Records
116
Agent score
79%

What's inside JetBrains MPS

  1. Overview of the Notes Organizer sample language

    master

    The Notes Organizer is a sample language designed to demonstrate how to build organized note and task management systems within JetBrains MPS. It allows users to:

    • Enter and categorize notes or tasks.
    • Set priorities for tasks.
    • Manage task states.
    • Use form-like user interfaces.
    • Switch between different alternative editors for various visualization options.
    • Filter and sort displayed elements, mimicking classical form-based applications.
  2. Overview of the Financial Calculator sample project

    master

    The Financial Calculator sample project demonstrates how to use MPS-based Domain Specific Languages (DSLs) to specify financial calculations. It showcases the ability to define interactive forms that include:

    • Input mechanisms: Input fields, selectors, and checkboxes.
    • Logic: Integration of internal or external functions.
    • Output mechanisms: Fields to display results and support for outputting tabular data.
  3. Overview of the Requirement Tracking sample project

    master

    The Requirement Tracking sample project demonstrates how to implement language-agnostic requirement tracking within JetBrains MPS. It showcases several advanced language constructs used to link implementation code (Java, XML, etc.) to high-level specifications.

    Key capabilities demonstrated include:

    • Node Attributes: Using attributes to annotate nodes across different languages.
    • Multiple Editors (Presentations): Defining multiple editor views for a single concept and switching between them using editor hints.
    • Programmatic Editor Control: Accessing selected editor hints programmatically and selecting specific editors via code.
    • Reference Scoping: Using scoping to prevent duplicate references within collections.
    • Text Generation: Using TextGen to transform requirements into plain text files.

    The project is composed of several interconnected solutions:

    1. RequirementDefinitions language: Allows writing requirements/specifications directly in MPS.
    2. Specification solution: An implementation of requirements organized by sub-system models.
    3. Traces language: Defines a BaseConcept attribute that can be attached to any node to hold references to requirement entries. It provides a "ShowTraces" editor hint to display traces alongside code.
    4. ProjectCode solution: Simulates project code (Java and XML) that imports specification models and uses requirement traces to ensure conformity to specifications.
  4. Overview of MPS MCP Smoke Test for Intentions and Quick-Fixes

    master

    This smoke test verifies the end-to-end functionality of the Model Context Protocol (MCP) server in JetBrains MPS, specifically focusing on the intentions and quick-fixes surface. It ensures that an agent can:

    • List intentions and checker quick-fixes on nodes.
    • Apply intentions and quick-fixes headlessly.
    • Auto-apply execute-immediately quick-fixes during problem resolution.

    The test builds a complete fixture from scratch, including a solution, a model, and BaseLanguage imports, then parses Java code into BaseLanguage classes to exercise the tools.

  5. Overview of the Robot Kaja sample language

    master
    Robot Kaja is a sample language implemented in JetBrains MPS. It is designed to allow users to program scripts for a virtual robot. The language supports commands for navigating a rectangular space, interacting with objects (picking up or dropping items), and obstacle avoidance (avoiding walls).
  6. Explore The Simplest Language sample

    master

    The _theSimplestLanguage sample is a minimalistic demonstration of a complete language lifecycle in JetBrains MPS. It covers three core areas:

    1. Language Definition: Defines a single rootable concept containing one string property.
    2. Editor Definition: Implements a straightforward notation for the concept within the MPS editor.
    3. Generator: A generator that transforms the language concept into a Java class. The generated class includes a public static void main method which, when executed, prints the value of the concept's string property to standard output.

    This sample is intended for users who want to see the most basic implementation of a language, its editor, and its generator working together.

  7. Use the Expressions sample for MPS Type-system Trace experimentation

    master
    The Expressions sample provides a simple expression language designed for numeric or boolean formulas. It is intended as a lightweight environment for initial experimentation with the MPS Type-system Trace tool. Note that this language is intentionally basic and may not be user-friendly for complex production use cases.
  8. Use NodeAttributes in Generators and TextGen

    master
    This sample demonstrates how to handle NodeAttributes within MPS generators and text transformations (TextGen). It covers various scenarios where attributes attached to nodes need to be processed or utilized during code generation or text-based transformations.
  9. Understand the purpose of the mps-rcp plugin

    master

    The mps-rcp plugin is designed to host general IDE functionality expected in most MPS-based RCP (Rich Client Platform) applications. It serves as a redistribution layer for common IDE-like features, separating them from the core mps-workbench (previously located in lib/mps-workbench.jar) and the specialized mps-ide plugin.

    Use this plugin when you need to share common IDE functionality across different MPS-based applications without including the full-fledged MPS IDE features or the language designer tools found in mps-devkit.

  10. Explore Sample MPS Java Extensions

    master

    The SampleJavaExtensions project demonstrates how to extend the Java language with custom constructs using JetBrains MPS. These samples cover language definitions, IDE customizations, dataflow analysis, type-system definitions, and code generation techniques.

    Key examples include:

    • DecisionTable: A tabular language element for logical conjunctions, fully integrated into Java and keyboard-manipulatable.
    • ParallelFor: A concurrent version of the for loop that can use ExecutorServices or direct thread spawning. It includes IDE safety checks for non-final variables and mutable objects, utilizing @thread safe and @non thread safe annotations.
    • IfAndUnless: Demonstrates smooth integration of new control-flow constructs and advanced dataflow problem handling.
    • Constants: A declarative way to specify Java constants with support for refactorings and intentions; generates a final Java class for direct use.
    • Money: A simplified money language featuring Money Literal constructs and specialized editor actions to transform numbers into money literals.