baseLanguage.sugar - little additions to base language

I adore ability of MPS to seamlessly extend languages. From this love and my love to Python and Ruby syntax sugar came this project.

Simplistic string format - no more chained string formatting calls, less clutter, more action
string message = "My name is %s, I am %d years old" % "Isaac Newton", 18;
assert message equals "My name is Isaac Newton, I am 18 years old";

Inline 'if' - Ruby style if. 'Do something' if 'condition'
int t = 0; 
t = 5 if t > 0; 
assert t == 0;

Inline 'unless' - inverted if. 'Do something' unless 'condition'
int t = 0; 
t = 5 unless t == 0; 
assert t == 0;

There is one gotcha with if/unless statements. If you want convert existing statement into "unless/if" statement you need to place your cursor AFTER ending semicolon and start typing respective keyword.

Download distribution package from github

Project page:

Installation instructions is in readme file
With MPS 2.5 it's possible to package your languages as IntelliJ IDEA plugins and upload it to IDEA plugin site:

So, you can publish your language extensions there as a plugin.
Thank you, Alex, will try that soon.

Please sign in to leave a comment.