Integration with IDEA

I presume the eventual use case for MPS is to allow DSLs to be embedded directly into each other (and into Java source) in IDEA.

Can you give any early indication as to the syntax that will be used for this?

5 comments
Comment actions Permalink

Not exactly. MPS allows to mix DSLs (ie. either use extensions in a base DSL or inject pieces of one DSL to another orthogonal DSL). But all our DSLs are graphical. The MPS editor manipulates with structured data directly. Thus there is no need to develop a syntax to glue things together. The downside of this is that the integration with the textual languages gets problematic. We don't plan such kind of integration so far.

0
Comment actions Permalink

I see.  So, to take a common example, using a database query language DSL as part of a project (a la DLinq) will require the DSL program to be contained in a separate external file?

0
Comment actions Permalink

I'm not from MPS Project Team, but I'll try to answer you (sorry in advance, if my answer would be incorrect or incomplete).

If you want to create DSL for a-la object query language (as, for example, HQL) in MPS-like style, you need to perform additional tasks to integrate it into your IDEA environment.

For example, you might want to use your query language inside string, which is parameter of  smth like findAll("...") method, returning collection of objects - it's common use case for "a-la query languages". If you want to do this with MPS, you need to "scale up" your task up to class level. In other words in simpliest case you need to:

- create your DSL "a-la HQL";

- create external context for it (now it's impossible to import Java stubs into MPS directly, so you need to declare your objects inside MPS explicitly);

- create target Java class(es) - at least one with one (static?) method per query, returning appropriate collection or object;

- generate target Java classes with "Generate from model" task.

At this step you are ready to use MPS-generated class(es) inside IntelliJ IDEA.

As conclusion: MPS is great solution for "large-scaled" problems, but now it's conceptually inapplicable for solving "local" problems inside external environments:)

0
Comment actions Permalink

Yes, the DSL pieces to be kept in separate files (models). It is not that bad because it doesn't require migration of the whole project to the new programming platform.

In my view, the general pattern is the gradual DSLization of selected parts of the project.

This scheme assumes that the core parts implement some kind of plugabilty so that generated pieces can be absorbed by the system.

One example such approach is shown in the Martin Fowler's paper(http://www.martinfowler.com/articles/mpsAgree.html#DefiningTheGenerator) where the DSL is used to setup (configure) the 'service agreement' object.The generated class (AgreementRegistryBuilder) obviously a small (but hard) piece of whole system which has been successfully DSLizated.

Other example is the MPS project itself, which is a mix of java and DSLs (roughly, it is 25% - 40% - 36% in handwritten, generated code and models respectively).

0
Comment actions Permalink

That's fine; it changes my view of MPS a little.  I was under the impression it could be used to augment Java with 'custom language extensions' -- however I see now that it is best used to write entire subsystems of a larger project.  In this way it differs in focus from Microsoft's language integrated DLinq.  I must confess I'm keen to try DLinq as much as I want a finalised MPS :-)

You don't need me to tell you that integration with IDEA is still key -- I would hope that navigating between parts of the project will be well implemented, regardless of what language they are written in.  This goes some way to alleviate the need to mix the languages on the source level.

Thanks for your reply.

0

Please sign in to leave a comment.