---
title: "Blog - How to setup Mbeddr with MPS"
url: https://ad301.org
---

Introduction

JetBrains’ Meta Programming System (MPS) is a tool that allows users to define Domain Specific Languages (DSLs). DSLs are typically small languages that - in contrast to General Purpose Languages (GPLs) - focus on a specific problem domain. A DSL in MPS is converted into a target language using a generator. By default MPS only supports Java as a generation target language. The Mbeddr project aims to provide C as a further target language, however, the setup is quite mystical.

As such, this tutorial serves as a quick reference and step-by-step instruction set to setup a minimal working example of Mbeddr in MPS.

You can open the final working project here!

Disclaimer

If, during this tutorial, you ever think “Wow, this is confusing! Does the author even know how this all really works?”, the answer is most certainly “No!”

I was only able to achieve anything using MPS and Mbeddr thanks to Sergej Koščejev!

This was quickly put together so others may have a minimal starting chance, if you have any feedback please feel free to message me at pilkiad+mps@proton.me.

Step 1 - Download and install MPS

Mbeddr is officially supported for MPS 2018.2. You can download it on the list of previous versions. The good news is that if you choose to download the linux application (tar.gz) the installs are self-contained and you can download many different MPS versions without fear of conflicts. Just unpack the tar.gz file and place it somewhere you will remember.

Step 2 - Download and install Mbeddr

Head on over to the download page of Mbeddr. Once there, you want to click on the link titled “all-plugins”. At the time of writing this tutorial this is the direct link to the file.

You then want to unpack the file com.mbeddr.allInOne_2018_2_0.zip, the resulting folder will simply be called plugins. Go ahead an copy all files and subfolders withing plugins into the folder of the same name inside the MPS installation.

Your MPS folder should look somewhat like this:

MPS 2018.2
|- about.txt
|- bin
|- build.number
|- build.properties
|- build.txt
|- jre
|- languages
|- lib
|- license
|- plugins              <-- This is where the 'plugins' content should go
|- readme.txt
|- releaseNotes.txt
|- samples.zip

NOTE: For me, copying the file build.properties resulted in IDE errors down the line, so I left that one out.

Step 3 - Create a hello world

Setup the project

Once Mbeddr has been installed by pasting the files into the plugins folder, open up MPS 2018.2.

Create a basic DSL

We need to create a very basic DSL in order to be able to generate anything. What exactly happens inside the DSL is not to important, we just want a rootable concept so the generator has something to reference.

For now, we don’t need to worry about anything more complex (like defining an editor).

Define a basic generator

Step 4 - Try it out!

Assuming that by some miracle all the steps worked so far and you were able to follow, right click on your language HelloCLang and select Rebuild Language ‘HelloCLang’.

If all has gone to plan you should now see:


Comments

Leave a comment


https://ad301.org/ [Blog - How to setup Mbeddr with MPS] [+]

0,0-1

-- VISUAL --