Importing existing text-based DSLs

Is there a "best practices" for importing existing text-based DSLs into MPS? I would assume, at a minimum, one will need to define the AST nodes for the DSL, but how does the developer convert the DSL into the format used by the MPS editors? This seems like a good topic for short tutorial or at least an entry in the FAQ on the Wiki.

Thanks for any insight into this,

Kevin

5 comments
Comment actions Permalink

Hello, Kevin.

We actually haven't done this a lot so I don't know about the best practices. The most common use case we had is to create special stubs models for a language, for example, java_stubs for java models. I think, the best way to convert text based DSL is to define a parser, create a syntax tree for your code and then convert this syntax tree into MPS' format.

Regards,

Konstantin.

0
Comment actions Permalink

Hi Konstantin,

Thanks for the response. Please pardon my newbie questions as I get my head around how MPS works. So, to clarify, I would assume that I would define my DSL's language in MPS (essentially, define the AST nodes that I'm already using outside of MPS) and then generate XML to represent a given "program" of the DSL for MPS? Do you have schemas for or documentation of the MPS file formats? I'm looking at one of the .mps files from the generator demos and it seems straight forward.

Thanks,

Kevin

0
Comment actions Permalink

Hello, Kevin,

I don't recommend you manipulating our files directly. Format seems straightforward but there are things which you need to consider in order to make your program fully support it. I recommend you downloading MPS and taking a look at its source for this task.

You can write you code in Java and use it from MPS. You can create an IDE action and call it from your code. There are plenty of example in MPS' code base.

Regards,

Konstantin Solomatov

0
Comment actions Permalink

Just tell me that the parser generator support is planned, I can't imagine using the MPS concept instance serialization for any project I have been involved in. I can't imagine I would define the DSL grammar twice (once for the parser and once for MPS). Not even speaking about the IDE Action fairy tail...

Vlada

0
Comment actions Permalink

Hello, Vlada,

We don't have plans for any parser generator support out of the box. If you want to benefit from MPS most, we recommend you store all your DSLs in MPS. Otherwise you won't be able benefit from reusable language infrastructure, IDE, etc.

Regards,

Konstantin

0

Please sign in to leave a comment.