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: https://github.com/ushkinaz/language-sugar

Installation instructions is in readme file
0
2 comments
With MPS 2.5 it's possible to package your languages as IntelliJ IDEA plugins and upload it to IDEA plugin site:  http://plugins.intellij.net/category/index?pr=idea&category_id=92

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

Please sign in to leave a comment.