Saving the actual DSL format

Hi all,

I'm looking into using MPS as an editor for my custom DSL.. and (sorry folks?) I mean merely as an editor; that is, I don't need to generate java or anything else than the DSL itself.

I understand I can simply use textgen for this, but my questions are:

  • using textgen "forces" me to keep the editor and textgen always in sync: would there be a way to automatically generate text "as layed out on screen" ?

  • textgen is apparently one way only, but ideally I'd like to reload my project from it's text form (along with the changes i've made with Vi for instance).. pretty much like I would use Java and Idea in a sense.. but i suspect that's not possible.. ?

Thanks a lot for the support.
Just save and open the project, and solution models will be loaded as well.
thanks Askar, but i'm not sure you answered my question.. I know MPS can save the project and reload it again, but it does so using its own XML format. What I need is to save (and ideally reload) my own DSL in plain text.
..or am i missing something?
thanks Vaclav, yes, that looks more like it. I would need to experiment with this option, although it looks quite a bit more complex than the textgen option.
(btw, could you also please advise on my other question labeled "java code completion"? thnx)
Hi Arjun

Yes, from what could help you, custom persistence is what we currently have.
However, 2 things have to be noted

1) What you describe is a workflow typical for traditional approach to languages where programs are stored as text. MPS has taken another approach where program persistence is not related to the language structure and program ast. You mentioned you really only need the editor. So, are you certain that you want a projectional editor?

2) Custom persistence can help you in the sense that textual presentation of a program technically is just another kind of persistence. But it won't come for free, you'll have to implement it, use a parser, etc. And as it currently stands you'll have to keep in sync 3 things instead of 2: not only editor and textgen, but also persistence.

That said, we're currently working on a different way to specify your editor, from which you'll be able to get textgen for free (at some point). Textgen is simple. As for getting a parser for free (for you to be able to read programs from text, not only save), that's another story. Also possible, but the priority, time frame and whether it'll be done at all, is not clear yet.

After all, MPS is about being able to mix different languages easily, which doesn't live well with parsers.

Could you elaborate a little on how you'd like to reuse mps editor? Is it a web app, a desktop app (which I would suppose, judging by your other question)? Maybe an Intellij Idea plugin?
Hi Daniil,

Thanks a lot for your interest, I'll try to clarify..

1) I do understand the difference, and indeed my need is more about creating a custom editor than really manipulating the language's AST (although at some point you do need the AST for more advanced editing features). The goal is to have a simple editor for use by "functional people" (not devs), and one of the DSL they'll be manipulating is actually a sort of EBNF. Whether I'm certain that I need a projectional editor: absolutely not! MPS was suggested as an option to create a specific editor, but I'm still evaluating this option; feel free to suggest other tools that could be more adapted to our needs.

2) for various reasons (versioning, traceability, continuous integration, auto-tests...) the "compiler" of the DSLs will live outside MPS and we do have the parsers and code generators built independently of the editor. For these reasons we need the DSLs to be saved as such, so they can be compiled. Indeed, I'm talking about a traditional approach. And we're talking about a desktop app.

I understand that the focus of MPS is its internal representation of the AST and how it can be projected onto both editors and generated code. I'm not sure if it's the best tool for our need. At most, I have the feeling that we can manage with it :)

Please sign in to leave a comment.