What's the "output" of MPS? Follow
I may be too thick to understand this - but I what's the output of the whole MPS process? What do you get in the end?
I looked at the tutorials and saw the generated JFrame UI, saw the generated code from the sandbox - but what real-world usage is there for such outputs?
For example, javac - Input are java source files with and library jars - output is class code that matches the source files and interacts with the library jars.
MPS - input is a language specification (AST parsing instructions?) and "generators" - output is... what?
Please sign in to leave a comment.
The output of MPS are generated files. They may be java, xml or any other kind of files. We have good java integration so in case of java files, MPS can compile them automatically.
No, sorry, still don't get it.
What do I do with these "output" files? Let's say I choose a java files output - how can I then use these files in my java-based application?
You can create a module/project in your favorite IDEs and set output folder of MPS as a source folder there. Then, you will be able to use these files in your project/module.
You seem to be missing my point (or me your answers).
I don't (currently) care about the technical side of using the MPS output files. I want to understand how are these files can be used in my project. Why shouldn't I model my DSL in Java directly - what's the added value of MPS? And saying I do use the generated DSL in my project - how do I tie in the DSL to my existing API?
MPS allows you to use domain specific notation inside of Java or in a standalone DSL which will rise level of abstract of code. In addition to ability to define a DSL, MPS provides a lot of infrastructure: editor, navigation, find usages, type system. You don't have to implement all these stuff from scratch.
You can tie your DSL to your API with generator. Generator will create classes that use your APIs. Actually, many APIs look like language expressed with classes and methods but because of limitations of them, code might look verbose. You can improve this with DSLs.
I must be thick.
Is there an example in the MPS samples folder for such tie-ins?
If I understand correctly, I should look for:
1. "Client" code using the MPS generated classes.
2. "Server" code responding to MPS calls.
Ok - I'll try a different approach.
Let's say I've developed a genius langauge for querying data sources - GQL (genius query language).
Example of a query:
"select ds1.attr1, ds2.attr2 from ds1, ds2;"
Let's say I've modeled the language, created generators, editors and what's not (I'll get back to this in a bit), generated the java classes, packaged them into a jar and shipped to my client.
How would the client (java) use it?
1. languageProcessor.process("select ds1.attr1, ds2.attr2 from ds1, ds2;"); ?
2. Select.withDataSource("ds1").andAttribute("attr1").andDatasource("ds2").andAttribute("attr2").from("ds1", "ds2");
3. Some other way?
Now - what would happen when the client does whatever he needs to do in Q1? What part would he talk to (generator? actual language structure?)
How do I hook my genius backend processor to the langauge frontend?
Am I in the wrong direction completely?
There're probably no examples of such folder in MPS distribution, but if you download MPS source zip and open it in IDEA, you will see large number of source_gen directories.
In 2, do you mean calls generated by MPS?
Are you familiar with Model Driven Development? In it you transform your
models (i.e. UML class and potentially sequence diagrams) to some sort of
code (java, xml, c# ...) which is typically utilizes some sort of API for
example if you take JPA or JDO you can generate a very complete persistent
domain model from UML class diagramm against JDO or JPA or some sort of DAO.
The output will include interfaces, implemenmtations for your domain model
xml metadata if any, some factory classes or hooks to IoC, you could
generate RESTful web services ....
you will use predefined transormers/templates or write your own.
also note that from one model you could generate it for different target
APIs (i.e. JPA vs JDO) or languages Java C#
DSL is one step above in generalization above graphical models like UML I
What bugs me is that i can not come up wit a really compelling and NOT
ARTIFICIAL case for using DSL.
MPS would go long way if it had a non trivial commonly useful example. I
doubt the product will make a hit on techical merrits unless there is a
really strong conceptual + implemantation example
Maybe a persistent domain object model with web services (or RESTFul web
services for CRUD operations) and + generic GUI generation perhaps
"Ran Biron" <firstname.lastname@example.org> wrote in message
Instead of working on a text level, MPS works directly against abstract syntax trees. MPS is not a lexer/parser, and would not (directly) store the query in your example as text.
I think that is simultaneously its biggest strength and weakness.
You can do really neat and useful things I think that people haven't even begin to explore yet when freed from the shackles of syntax.
However, unfortunately, there are hundreds if not thousands of text editors out there, and only one MPS-compatible AST editor I know of, which is MPS itself.
I would take a look at ANTLR, if your needs involve parsing text into a model - ANTLR kicks some serious butt when it comes to making grammars.
That said, I do think MPS has some huge potential to do amazing things that a lexer/parser could never hope to! Parsing text grammars just isn't one of them... :-)
Regarding the "MyQueries" part - that would force my client to define the queries in MPS and use it to generate the code, no? Is there some "standalone compiler" that might do the job (or better yet, an "online" compiler that can be used inside a java project?)
What I don't get is what can you do with your DSL after you've generated it? I mean, writing something as compelx as a DSL to represent some internal structures and using it as a "one shot", where only I (with the MPS) can create queries for, seems a wasted effort. I'd better use regular models and be able to expose this to my entire team / project / clients.
On the other hand, writing a DSL that connects between my internal concepts and some business level concepts in a structured way (think "SDK") - that's something much worth the effort.
Please see the answer I posted on the thread AlexR replied to.
For that scenario, I don't think MPS is what you are looking for... if your language must be consumed by a mass audience that is already using Java, writing a set of classes in Java and possibly a DSL written with something like ANTLR sounds like a more natural fit.
If you ever have run into scenarios where subclassing/inheritance just aren't good enough abstractions for what you need, and you find yourself getting lost in the noise of boilerplate code, or writing something as a bunch of method calls just isn't a natural fit, or you have some syntactic sugar that would sure be helpful to readability and clarity in your code, etc... MPS will shine here.
So how can I use the langauge I create in MPS outside MPS? Please note I'm saying the language, not the saved queries.
You can use language created with MPS only within MPS.
Than the best thing MPS can be is a macro processor?
What's the point of building a langauge in MPS if I can't use it anywhere else? How would I ship that language to my customers? How would they use it?
MPS is IDE for lanuages which are created with it. You can do almost everything with and for your language there.
Actually you can. There are two available options now for language distribution (you can read more about them here: http://www.jetbrains.net/confluence/display/MPS/Build+languages);
In the future we will have yet another option: ability to create IDE only for your language with language development, etc UIs removed.
While I recognize the value of MPS, I kind of agree with your sentiment. It seems to me that one of the most powerful uses of a domain specific language would be to make your domain layer something that could be utilized via DSL queries. This would be particularly interesting for a SOFEA architecture, because within the web application, you could fully specify (in your DSL) the behavior that the web application requires of the server. The granularity problem disappears.
This effectively makes your service an easy-to-maintain, single-layer system with a cohesive parser interface, whose design is driven by the desire to write queries in a clear and concise way. The ability to submit transactional queries in an ad hoc fashion makes the code very exercisable and testable.
An interesting side effect of this approach is that rather than configuring access-controls on particular service methods, you need to implement access controls on data. Information ownership becomes a first-class feature.
While the current incarnation of MPS wouldn't be useful for such a system, I wonder if a future incarnation could be. Am I off my rocker?
Exactly. I can't ship out MPS. I can't convert my entire development base to an MPS created language - what I would love to do is craft a language in MPS that works as an interface to an "engine" created in another language (i.e. Java). Then I'd be able to allow my users, or even myself in my configuration builder hat, to use a sensible, domain specific idioms to control my software.
(Bump, on the off-chance that you'd want to evaluate the contents of the sister thread.)
Yes, but using MPS negates using my product - I can't embed MPS (and I don't want to).
maybe I'm a little bit late with my answer but perhaps you will read it anyway. So let me just give my two pence:
Wow. Great answer.
So, in essence, MPS is similar to a script generator (a "scripted" generator?). Its output are intermediate constructs - not something that can be shipped to a customer as is. They need to be wrapped, executed, parsed, compiled...
Don't get me wrong - I'm not belittling it. Generators have their place and use. Indeed, I was under the misconception MPS is like IDEA - an IDE that is used to create end products. I think this distinction should be highlighted on the main page of MPS (probably with a link to your post - it's THAT good :-)).
Now that I understand what it does - where can I find well built examples of langauges, use case stories, etc? There are some areas in my code that could benifit from being automatically generated.
well, also IDEA output is in most cases not ready to be shipped - often tools like ant and maven are used to package it, transform XML config files, create version numbers and so on. And so the MPS output is: in best cases the MPS output is nearly the end product. Jetbrains does this with YouTrack/Charisma. But as it happens, DSLs are very old and wide spread, but the everybody-creates-her-own-DSL-hype is just lifting of these days. And so full generation of products is not wide spread, but with tools like MPS it will become much easier and common. State of the art for now is indeed a partial generation and partial hand writing the code.
I compare DSLs these days with design pattern and refactoring in early days - not much tools, not much literature, not so good common understanding how to do it. But if you google a bit, you'll find plenty of examples and articles, mostly using oAW. You simply have to adopt it to MPS ;-) For MPS I don't know production success stories or other war stories/languages except the ones from Jetbrains itself.
Perhaps we could do something in the community using the wiki. (Yes, there is a MPS wiki, but unfortunately its not mentioned on the docs page and only with little content for now.)
I know this is an old post but this post explained MPS for me better than the product homepage. Thanks for the article.