Features News

Plugin spotlight: Generate Python or Ruby with MPS-plaintextgen

The guys of DSLFoundry have brought my attention to the MPS-plaintextgen plugin recently. The plugin offers a language that models textual documents as collections of lines and words, supports layouts, alignment and indentation, and in addition to that, it comes with decent editing experience built in.

The binaries of the plugin can be obtained from the JetBrains plugin repository.

The language is primarily meant to be used in generators to ease transformation of complex models into text. Unlike with the TextGen aspect in MPS, the plaintextgen language allows you to leverage the model-to-model capabilities of the MPS Generator and enjoy the comfort of the projectional editor when defining the transformations. You simply model the output document and parametrize it with values from the input model.

This can be useful in several interesting ways:

  • generate textual documents from your models without the need for TextGen
  • quickly mock the generator for your prototype languages during development
  • generate code of limited complexity in general-purpose languages, for which MPS does not have support

As a proof-of-concept, I’ve created a sample project that uses the MPS plaintextgen language to generate Python and Ruby as well as plain text. You can check out the MultiLangEntities project on GitHub.

ml4

ml1

The Drive to Develop
-JetBrains MPS Team

Discover more