MPS
 
Get MPS

Building an interpreter cookbook

Last modified: 11 February 2024

Check out the Shapes sample project, which is bundled with MPS since version 3.1. It can do some fancy tricks in the editor.

By default, the editor shows plain code that consists of commands to draw visual shapes of given sizes and colors on a canvas.

I1.png

The code can be generated into Java and run. This will start a new Java process running the application that just has been generated from the code above:

I4.png
I5.png

MPS can, however, also interpret the code without generating Java. Press AltEnter  anywhere in the code to invoke the Intentions pop-up menu and choose "Preview Scene". You'll get a new frame containing your scene, which is interpreting the code:

I6.png
I7.png