question about using dsl
Correct me if Im wrong
- Develop DSL and build custom compiler e.g. smth like javac.
- User creates some text file according to DSL rules.
- User invoke "dslcompiler file.txt" and it compiles.
- Profit
Is it possible to use MPS this way? Or I MUST edit and compile dsl files in MPS editor?
Please sign in to leave a comment.
Hello, Alexander!
User should edit DSL files inside MPS IDE. This is one of the goal -- MPS allows to easily create IDE support for domain specific languages, so using them inside MPS IDE would be comfortable. Files on the DSL are model files and they are saved in special xml format. For getting text files for those models you should define generator from your DSL to text (or to some other language which already has a generator). Then you can compile text files as you wich. So basic workflow is as follows:
MPS work with dsl is quite new, you can find links to articles about MPS and documentation here: http://confluence.jetbrains.net/display/MPS/Welcome+to+JetBrains+MPS+Space
--
Regards,
Julia
Hi,
I need clarification on one point : the real end-user input. Model or text file ?
Say I have a language L, not sure if it is a DSL or not but definitively a language.
I have a compiler for that language L.
I don't have IDE for that language and it is a shame in the 21st century to force end-user to use vi, textpad, ... :-)
I understand from your answer that with MPS end-user have to start wioth "model" (not sure to see exactly what is it in MPS terminology compare to UML for example).
That's not what I would like since end-user of that L language would like to have an IDE for the text language L not for some model that would "reflect" L.
Of course it is a good feature to be able to start with model but I don't want that to be mandatory.
Like a Java dev that would like to be able to edit Java text with IntelliJ rather than editing Java from UML model in an IntelliJ plugin.
So, is it doable with MPS to be the IDE for that L textual language (I mean without need for UML like models) ?
I'm not sure I was clear :-) feel free to ask
jbb.
Hi,
Now it's not possible to use MPS for editing textual languages (at least MPS 1.5).
But we plan to introduce custom model persistance ability into MPS. Having this done, it will be possible to convert text files to models and back while loading/saving. So, you would be able to use MPS for working with textual languages while losing the ability to extend them and while you are restricted with languages for which you can make a parser.
Jean, could you please provide some additional information about the use-case you suppose MPS to be used in? Maybe I could propose a way how to make it work in current version.
Regards,
Mihail.
Hi,
Thanks for you ranswer. Yes, I can give more precision :
The use case is to use MPS as the IDE for a textual language L.
I thought I could enter a grammar that would define/describe my L textual language and MPS would then behave like IntelliJ for my L language.
I though later I could add generators to produce something from my L language but first I would like to have an IDE (editor, coloour syntaxing, ctrl-space, ...) for the L language from its grammar.
I don't need model at all.
Ok, so if you want to use MPS editor for your language, why does the persistence format matters? It could be important if you'd like to use some 3rd-party editor, I think.
In any case, you can look at IModelRootManager interface (in MPS source code). Its load/saveModel methods are used for model loading. You can try to register your own manager that would load models from text files.
As I've said before, a language support for that feature is planned for 2.0 (not only language, actually - parsing text files every time will take too long, so the support of this feature includes some performance-related tasks).
If you have any further questions, feel free to ask.
Sincerely,
Mihail
Hi,
I think you might misunderstand what we mean by saying "model". MPS models are not like UML models. They rather reperesent an abstract syntax tree of a program, but the experience of working with them in MPS is quite close to editing text (though there are several differences, since it is not text at all). Every program in MPS is a model. For those models you can have the IDE support you need: ctrl+space, syntax coloring, find usages and other cool stuff.
--
Regards,
Julia
OK, that's a very good remark.
Model are not model like in UML but like in AST : that's fine.
I still don't understand if I will be able or not to edit text file that syntax would reflect that AST I defined via MPS model ?
The only thing I need first is a pure text only editor with the power of a real IDE for a language.
I don't care what way I'll have to use in MPS to get there : I can define AST model if I can then get a text editor IDE for a textual language.
Later on I may think about generator.
In other word, I don't care about what the "language specificator" will have to do (like edit AST model in MPS),
as long as the "language user" only have to edit text file and dont have to deal with AST model.
So, is MPS able to do that ?
If I understand correctly, your question is: "Can I by describing my language XYZ in MPS and some magic get an Intellij-Idea-for-text-files-on-XYZ-language?".
The short answer is:
No, you can not.
The long answer is:
I hope this comment will make some things clear. Thank you for interest in MPS.
--
Regards,
Julia
OK, thanks, it is quite clear now.
In fact, I was trying to find something like XText in the IntelliJ world.
I found the folowing one for Netbeans or Eclipse :
http://www.eclipse.org/Xtext/
http://wiki.netbeans.org/Schliemann
So, I'll have to choose between the 2 previous one I'm afraid ...
Hello!
You right - for now MPS is not a substitution of Xtext. If you have some fixed grammar with textual files conforming to it and would like to create an IDE for editing these files directly then probably you need to choose another technology (not an MPS right now). As Michael already mentioned, we are going to move in this direction in future release(s) so probably later we will be able to offer you something like Xtext...
Just few words about using MPS for an existing languages now - I'll try to answer your question "How can I use MPS if I already have custom language and bunch of sources written on it and would like to continue working with this language, but using better IDE?" here:
As I said, it's not possible to store MPS model files (text of your program) in any other format except MPS XML persistence. This format is similar to EMF xmi files or any other xmi files containing basically an instance of the AST model. Using this model MPS is able to generate any textual files, so you can describe generator in MPS which will generate a program on this custom language from MPS model. In addition you can “plug in” to MPS existing sources written on this custom language and represent it as MPS models. As a result you'll be able to develop new parts of the program completely inside MPS while still having all the sources (including those files generated from MPS) written on this custom language.
Using this is a way you can try MPS now and decide later if you like it or not (if you'd like to completely switch to MPS-based development in your project or not). If you decide to write some part of the program in MPS then nobody should modify generated sources – modified sources will completely overwritten by next MPS code generation. If you don't like MPS, you always have a “way back” from it – you can simply remove all MPS models from the repository leaving only generated sources there and then continue working with generated code as with manually written. The only constraint here is: you can work with some part of the program either completely in MPS or completely outside of it – no mixture. :-)
So, if you can separate some parts of the program (new code) and develop it in MPS while supporting all the existing code in a way it was before and slightly move future development to MPS then this make sense for you and you can end up with using MPS as a main IDE with all required IDE features + generating code on this custom language from it.
I know, I'm describing a little bit special way of using MPS as an IDE for custom language – not exactly what you were looking for from the beginning (rather “migration path to MPS”), but it still can be useful for some projects and (I hope) can be useful for your project too. In case you'll have any future questions – do not hesitate to ask me about any details.
Hi Alex,
Thanks for your answer, this is clarifying MPS AST aproach.
Unfortunately, I don't want to produce text file (from AST of anything else) but starting from text file.
I also don't have plan to compile something from within MPS as we already have a compiler and don't want to rewrite it (for now).
So, the only goal is to have an IDE, if possible as powerful and cool as IntelliJ for our text language.
Could an IntelliJ plugin do the work (IntelliLang ...) ?
The question is how complex is the IntelliJ IDE API compared to the 2 other approaches found for Netbeans and Eclipse ?
Hi!
Well, I doubt I can give you professional answer to this question. I suggest you re-asking it in IDEA forum, sorry.
Hi,
Is there any news on that subject with the 2.0 release ?