Some questions about Jetbrains MPS

Hi guys!

Could please clarify some general questions on Jetbrains MPS:

1. Where can I find Java class generated from my DSL? Yes, I can right-click and see generation preview, but may be I can see exactly the class to be compiled and ran if I press Run in Calculator Example? When I press CTRL-N and open a class I expect to be Java class – I rally open DSL class, not generated Java class.

2. Given I want to insert Decision Table into Java code. I know there are some examples. But that table is going to be compiled into Java code. A question is: can I create Java extension which is using Decision Tables, but tables are compiled into some text file? I mean resulting code is something:

 //now it comes to decide..

DecisionTable table = context.readTable(‘someFile’);

Boolean decision = table.decide(value);

BUT in the same time the table itself is being edited in JetBrains MPS DSL and saved (or compiled) to separate file.

3. I know I can create DSL which extends base language. Also I can create DSL which is ‘standalone’. A question is: can I create DSL _which parts_ extend base language, and other parts do not?

An example:

My DSL consists of blocks which contain Java code. I put Java code into such a block and this generates Java code which executes that blocks one by one. For example, I want a DSL which consists of [] blocks, and inside [] I want to put Java code which should be executed in the same order as one finds brackets.

4. Is it possible compile DSL classes outside of Jetbrains MPS on some server on the fly?

Comment actions Permalink
Official comment

Hi Dmitry,

to your questions:

1. The module that holds your code specifies "Generator output path" on the "Common" tab. This is where the generated files will go

2. This is certainly possible. You will need a root mapping rule for your Decision table concept that converts the table into whatever is your desired format. At the same time a regular reduction rule will insert the short piece of Java code that reads the file and invokes its decision.

3. No, a language either extends another language or not. You can, however, separate the parts of your intended language into two languages - one standalone and one extending BaseLanguage.

4. Yes, we MPS generation can be triggered from Ant. MPS provides build language to ease creation of MPS-aware Ant build scripts -



Comment actions Permalink

Vaclav, thanks a lot! While I am contemplating on your answers please comment: what do I need to compile my DSL into Java outside of MPS? I mean - Ant, DSL text files, then some libs, right? 

Build language, as far as I understand, is a DSL itself to avoid writing build procedure in Ant. 


May be, you know some example which teaches me to build Java classes from DSL text file with the help of some MPS jars outside of MPS? With Ant its also ok.

Comment actions Permalink

You can check out the sample project to get an idea of both the Ant file and the build language script to create it.

One thing that needs to be clarified - your DSL code must be stored in MPS models, not in plain text files outside of MPS. MPS does not contain any parser that would make it understand textual languages.

Comment actions Permalink

Vaclav, so what is a list of artefacts I need to build DSL Java classes without MPS?

Comment actions Permalink

Vaclav, two more questions:

1) generator output path in common tab of a module is an output path of DSL files. thats ok, but if I create some usage of this DSL, for example if I have created Java extension and used it in a class in Sandbox - where can I file Java source? Or it doesn't exist because resulting class is formed in compile time from AST?

2) For some reaons intentions do not work for me while editing the code. For example, I cannot see intentions when typing Editor for my Concept. May be you know some solution?

Comment actions Permalink


1. The sandbox module also specifies its "generator output path". If you rebuild that module (right-click on it in the project view and choose "Rebuild ..."), you will get generated .java files

2. Intentions provide context-sensitive suggestions to changing the code and the content of the menu depends on the position of the cursor. Whenever intentions are available, a little lightbulb appears in the editor. You invoke intentions either with Alt + Enter or by clicking on that lightbulb. It surprises me that you are getting no intentions. Is there some exception reported from the IDE? Maybe you can try restarting MPS.




Please sign in to leave a comment.