Child pages
  • Fast Track to MPS

Versions Compared

Key

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

...

As an illustration that MPS is not limited to generating Java, we've prepared a similar Calculator sample project - CalculatorJS, which generates an HTML page and a JavaScript program to hold the computation. You may check it out on GitHub.

Step 9 - The Garage project tutorial

Raw time estimate - 5 hours

The Calculator tutorial should have left you with good overall knowledge of language design. Now it is time for a more thorough exercise. The garage project will have you create several interconnected languages, package them as reusable plugins and stack languages one above the other. To handle the complexity of this tutorial, we leverage the Stepik platform for online education. Enrol in the free MPS Elementary Course.

Step 10 - Generator tutorial

Raw time estimate - 4 hours

The final bit of knowledge that needs practising is the generator. The Generator tutorial will now teach you more subtle options that the MPS generator offers. You will learn about the different types of macros, generator scripts, utility models and more. 

Reviewing the progress

Congratulations! By completing the above tutorials and exercises you've made a serious dent into the language design world. Your knowledge and command of MPS could now be qualified somewhere above the Advanced beginner stage of the Dreyfus model of skill acquisition. This is definitely a good time to celebrate and perhaps also to let us know about you success.

Moving up the ladder

The next stage in the Dreyfus model of skill acquisition is Competent. Once you reach that stage you'll be able to work on your own without concrete guidelines and supervision. But for this to happen, you'll need to spend more time solving various problems with MPS. If you already have an idea of a language to implement, go ahead and do it. If not, try to come up with a useful little language. You could as well try to re-implement one or more of the MPS samples and then see how closely you got. Or just pick a sample as the starting point and move it forward - add language features, implement a generator, add type-system rules, polish the editing experience - whatever feels like the right challenge for you.

Additionally, you should try these in order to become Competent in MPS and language design:

  1. Study the Common language patterns
  2. Study the cookbooks to deepen your knowledge of the various aspects of language design
  3. Get to know quotations and anti-quotations
  4. Familiarise yourself with the languages bundled in MPS, such as closurescollectionsconcept functionsregexptuplessmodelbuild language and other
  5. Learn how to build MPS projects from the command line, how to package languages into IntelliJ IDEA as well as MPS plugins, how to use the plugins and how to build standalone DSL IDEs
  6. Get a feel for the user guide so you can quickly find the information that you need
  7. Learn some of the keyboard shortcuts by heart
  8. Become active in the MPS community and try to answer the forum questions of people that walk behind you on the same path to MPS mastery

After becoming Competent you should definitely continue gaining experience. The more you work with MPS and the more divert your projects are, the faster you'll be moving up on the Dreyfus model of skill acquisition scale. If you set yourself a goal to become Proficient and ultimately an Expert in MPS, you might consider trying:

  1. Studying and practising advanced topics, such as:
    1. Find usages
    2. MPS Make Framework
    3. Debugger enhancements and customisation
    4. Custom persistence
    5. Dependency analyzer and Module dependency tool
    6. Custom dataflow analyzers
    7. Extensions 
  2. Helping MPS expand into there areas by creating a base language for a different target language/platform - Python, Ruby, Dart, Haskell, Go, etc
  3. Speaking about MPS at events
  4. Helping us evolve the documentation
  5. Contributing code to the MPS project

Although there's not much detailed documentation to guide you at this experience level and you'll have to be self-driven most of the time, we'll always be happy to discuss, advise and cooperate with you.

Documentation sources

Here's a list of documentation sources that you may need on your path to MPS mastery

Books

Fabien Campagne wrote The MPS Language Workbench: Volume I and Volume II books, which you can purchase both electronically and as paper-back. Get them here.

Image Added Image Added

Academic papers

The publications page collects all relevant papers about MPS and the related field.

Cookbooks

The get slightly simplified practical information as well as some tips and tricks on individual aspects of language design, you may try some of the cookbooks.

User guides

A full-blown reference documentation provides exhaustive information on MPS. Check out the Language designer's User Guide.

Screencasts

Over time the MPS team has created a large collection of screen-casts covering many aspects of MPS use and language design. You may check them out all nicely sorted at the MPS screen-cast page or directly at the MPS channel of JetBrains TV.

Guided Trainings

The MPS team offers hands-on trainings. Check out the details:

General documentation

The MPS documentation page will give you all the remaining pointers to case studies, tutorials, FAQs and other pieces of MPS documentation.

Other sample projects

MPS comes with several sample projects that you may play with to get a better grasp of language development. I recommend you tried them out, perhaps in the order as they are listed below. Find out what they do and how they are implemented. They may teach you important lessons. Don't worry if you sometimes cannot figure out how a particular feature has been implemented. Most likely you will find an answer in one of the following exercises and then you can revisit the sample and the thing will just click instantly.

...

  • SampleJavaExtensions - a collection of small handy Java enhancements, such as as parallel for loop, unless statement statement, Money literal, decision tables and  and Constants definition definition. The sample will teach you how to extend existing general purpose languages with custom constructs. You may also like to to watch a short screen-cast introducing the individual extensions.
  • Complex - defines a Java extension to work with complex numbers
  • XML Literals - allows XML literals to be used directly in Java code as first-class language elements. The language builds on top of of jetbrains.mp.xml and generates into into org.jdom.* API API. The user-inserted XML code may refer back to the surrounding Java context to easily parametrize.
  • math - provides fancy-looking math language extension to Java, which allows you to enter complex numbers, matrixes, intervals, summation, product and other common mathematical operations in a natural way.

...

  • LanguagePatterns - a set of sample languages illustrating implementations of common language patterns in MPS. It is useful for beginners to see in isolation concrete implementations of typical language constructs. This sample project is gradually being updated with new patterns.
  • MultipleProjections - an example of a simple state machine language that focuses on the mechanism of multiple projections per concept. The programmer, who uses the language, can on-the-fly switch between several pre-defined notations as she progressed with her state-machine definition. All the available notations are defined in the language or its extensions.
  • MultiTarget - illustrates how to have a single language generated into multiple different target languages.
  • Custom Aspects - shows the ways to define custom aspects for language definition. Check out the the Custom language aspect cookbook for  for details.
  • Cross Model Generation(new) - illustrates how to use custom generator plans to  to achieve cross-model generation.
  • Component Dependencies - a minimalistic example of a language for expressing dependencies between components of a system, which provides three alternative editor notations:
    1. Textual
    2. Tabular
    3. Diagrams
  • Customized Debugger - an example of hooking a languages with the Java debugger, even when the language neither extends nor generates into into BaseLanguage.
  • Mind maps - an intuitive example of defining a diagramming notation, including a set of customized graphical symbols
  • State machine (Secret Compartment language/DSL book sample) - an example of a state machine language, including a state machine test language. An An overview screen-cast is available to  to help you get started.
  • The Simplest Language - a minimalistic example generating a Hello world application printing out a customized message. Shows the very basics of language generation.
  • Migrations - a simple example of migration scripts to migrate two interconnected languages using both the the smodel API and  API and TransformStatement.
  • Lambda Calculus - a language simulating lambda calculus, with projectional editor and generation into Java
  • Agreement - an example of a business-oriented DSL
  • Expressions - a simplified expression language to allow you to play with the type system and the the Type-system Trace tool. The language gives you a bare-bone expressions language with minimal editor support, but with well structured type-system rules, which you can help you learn the core of how MPS calculates types. Read more in the the Typesystem Debugging Debugging documentation.
  • Fixed Length Reader - illustrates how to create a language for describing binary data formats. Comes with a stub for a hypothetical runtime library that would extract elements from binary data using the supplied data format description (called configuration).
  • HighLevel Languages - an example of defining a custom set of language definition languages. Illustrates how to define your own way to codify structure and editor for a language.
  • Sample Language - A very intuitive and minimalistic example showing how to implement a common pattern of of a root concept containing definitions as well as references to  to them. In this sample, we simulate Java classes, method definitions and method calls. However, such a pattern is quite frequent in many languages and it is worthwhile to spend some time investigating. You may also check out a brief screen-cast showing you round this sample.
  • Formula Language - a sample definition of an expression language, including editor actions and a generator
  • NotesOrganizer - a sample DSL plugin for IntelliJ IDEA including a build script, that simulates a task/todo list. Tasks can have different priorities, states and categories, which by themselves can also be customized. The task lists can be filtered using several kinds of Swing UI components and the user can choose among several alternative visualizations of the task lists. Shows as an example of filtering node collections, alternative editors and direct incorporation of Swing components into form-like notations.
  • State Chart (new)  - an example of a state-chart definition language that generates state charts in the the SCXML standard.Attributes standard.
  • Requirement Tracking (new) - an example of a universal, language-agnostic requirement tracking language. Goals of a software project can be captured in specification documents written using the provided requirement tracking language. Mentions of relevant requirements can be inserted into code at places that implement these requirements. The mentions can be used in code that uses any MPS language. The sample features Node Attributes, non-trivial scoping and multiple switchable editors for a single concept.
  • Attributes - a sample illustrating the transparent handling of attributes in text-gen and the generator. The two CommentAttribute node  node attribute concepts are passed through the generator unchanged so that their text-gen can convert them to text.
  • Sample Facet - illustrates a simple make facet that intercepts the make process.
  • Lightweight DSL - examples of usages of the the jetbrains.mps.baselanguage.lightweightDSL language  language to build internal "lightweight" DSLs embedded into BaseLanguage classes classes.
  • Heating controller  - a simple language providing two notations to specify heating plans for a hypothetical home heating controller. The default notation allows for textual representation, while a language extension provides an alternative tabular notation.
  • Progress Indicator - a set of actions that illustrate the proper way to handle progress bars in actions, how to make actions cancellable and enable them to run in the background.
  • xmlPersistence - a non-trivial example of implementing custom persistence using the new Open API.The plugin contains three solutions (a build script, a persistence implementation and a plugin descriptor). The custom persistence implementation will load/save XML documents. Please check out our our Custom Persistence Cookbook for  for details.

Samples to tutorials:

  • Shapes - the language created as part of the introductory introductory Shapes Tutorial.
  • Robot Kaja - the language for commanding a virtual robot used in many of the introductory screencasts. Now includes a sample Context Assistant implementation implementation.
  • Calculator - the language created as part of the Calculator Tutorial.
  • Generator demo - the set of languages developed as part of the Generator Tutorial.

Step 10 - Generator tutorial

Raw time estimate - 12 hours

The Calculator tutorial should have left you with good overall knowledge of language design. The Generator tutorial will now teach you more subtle options that the MPS generator offers. You will learn about the different types of macros, generator scripts, utility models and more. 

Reviewing the progress

Congratulations! By completing the above tutorials and exercises you've made a serious dent into the language design world. Your knowledge and command of MPS could now be qualified somewhere above the Advanced beginner stage of the Dreyfus model of skill acquisition. This is definitely a good time to celebrate and perhaps also to let us know about you success.

Moving up the ladder

The next stage in the Dreyfus model of skill acquisition is Competent. Once you reach that stage you'll be able to work on your own without concrete guidelines and supervision. But for this to happen, you'll need to spend more time solving various problems with MPS. If you already have an idea of a language to implement, go ahead and do it. If not, try to come up with a useful little language. You could as well try to re-implement one or more of the MPS samples and then see how closely you got. Or just pick a sample as the starting point and move it forward - add language features, implement a generator, add type-system rules, polish the editing experience - whatever feels like the right challenge for you.

Additionally, you should try these in order to become Competent in MPS and language design:

  1. Study the Common language patterns
  2. Study the cookbooks to deepen your knowledge of the various aspects of language design
  3. Get to know quotations and anti-quotations
  4. Familiarise yourself with the languages bundled in MPS, such as closures, collections, concept functionsregexp, tuples, smodel, build language and other
  5. Learn how to build MPS projects from the command line, how to package languages into IntelliJ IDEA as well as MPS plugins, how to use the plugins and how to build standalone DSL IDEs
  6. Get a feel for the user guide so you can quickly find the information that you need
  7. Learn some of the keyboard shortcuts by heart
  8. Become active in the MPS community and try to answer the forum questions of people that walk behind you on the same path to MPS mastery

After becoming Competent you should definitely continue gaining experience. The more you work with MPS and the more divert your projects are, the faster you'll be moving up on the Dreyfus model of skill acquisition scale. If you set yourself a goal to become Proficient and ultimately an Expert in MPS, you might consider trying:

  1. Studying and practising advanced topics, such as:
    1. Find usages
    2. MPS Make Framework
    3. Debugger enhancements and customisation
    4. Custom persistence
    5. Dependency analyzer and Module dependency tool
    6. Custom dataflow analyzers
    7. Extensions 
  2. Helping MPS expand into there areas by creating a base language for a different target language/platform - Python, Ruby, Dart, Haskell, Go, etc
  3. Speaking about MPS at events
  4. Helping us evolve the documentation
  5. Contributing code to the MPS project

Although there's not much detailed documentation to guide you at this experience level and you'll have to be self-driven most of the time, we'll always be happy to discuss, advise and cooperate with you.

Documentation sources

Here's a list of documentation sources that you may need on your path to MPS mastery

Books

Fabien Campagne wrote The MPS Language Workbench: Volume I and Volume II books, which you can purchase both electronically and as paper-back. Get them here.

Image Removed Image Removed

Academic papers

The publications page collects all relevant papers about MPS and the related field.

Cookbooks

The get slightly simplified practical information as well as some tips and tricks on individual aspects of language design, you may try some of the cookbooks.

User guides

Full-blown user guides will provide exhaustive information on their respective subject.

Screencasts

Over time the MPS team has created a large collection of screen-casts covering many aspects of MPS use and language design. You may check them out all nicely sorted at the MPS screen-cast page or directly at the MPS channel of JetBrains TV.

Guided Trainings

The MPS team offers hands-on trainings. Check out the details:

General documentation

The MPS documentation page will give you all the remaining pointers to case studies, tutorials, FAQs and other pieces of MPS documentation.