Child pages
  • Shapes - an introductory MPS tutorial

Versions Compared

Key

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

...

First, the jetbrains.mps.core.xml language must be imported (Control + L). It is the projectional equivalent to xml, as we know it, just like BaseLanguage is a projectional equivalent to Java.

 

A root mapping rule must be created to convert Canvases into xml files.

Image Added

Image Added

The template named map_Canvas gets created.

Image Added

Xml code must be typed into the template in order to create the required code:

Image Added

Image Added

In order to insert the name attribute, type "space" followed by "name=":

Image Added

A property macro must be set on the contents of the name attribute value:

Image Added

Image Added

Some more xml needs to be inserted:

Image Added

We create a placeholder for all the shapes:

Image Added

With Control/Cmd + Up select the placeholder xml element:

Image Added

Then insert a COPY_SRCL macro to loop through all the shapes of a Canvas and trigger their reduction rules:

Image Added

Image Added

What to do next

Congratulations! You've just completed your introductory tutorial into MPS.

...