Generating Javascript file(s) instead of Java classes

I was wondering if there are any tutorials or documentation on how to generate code in languages other than Java.  The description of MPS calls out Javascript as an alternate language as well as XML, but I can't find any help on it.

I'm specifically interested in Javascript at the moment, but info on other languages would help too.  Also, if anyone out there has done this on their own, I'd be very appriciative of an example or two.  Thanks!

8 comments
Comment actions Permalink
Official comment

You may try https://github.com/mar9000/ecmascript4mps, if you plan to generate JavaScript from MPS.

Vaclav

 

Comment actions Permalink

We have javascript language internally but we don't include it in the builds yet. You can expect it to be available in future builds. Until then, you can use gtext (our plain text language) if you need to generate javascript from some stuff.

0
Comment actions Permalink

We have example where input language is generated to 'jetbrains.mps.sampleXML' language - demo 6 in generator user's guide.

In general, if you want to create generator to target language L, you would simply use language L in the generator's templates (probably everyone is understanding this - just to make the point totally clear).

But, to get a text as result of generation, the target language L must either be able to render itself as a text (only baseLanguage and gtext as yet) , or be generatable into other language. In the latter case the generation will proceed until the output model only contains code in baseLanguage or gtext language.

For the instance, the 'jetbrains.mps.xml' language has generator to 'jetbrains.mps.gtext' language. Therefore, if you use XML as your target language, the text eventually will be generated.

Regards, Igor.

0
Comment actions Permalink

I know this is an old thread but can I ask are you still planning to at some point release the Javascript language implementation in a build or will it remain internal only?

The reason I ask is because MPS won't really be useful for me until I can output to Javascript. I understand that MPS allows me to trivially implement this on my own but I have a feeling it could be relatively time consuming. Also can I ask are there any reasons you haven't already released it either in the builds or as an additional language like you do here: http://confluence.jetbrains.net/display/MPS/MPS+Languages+Repository

i.e. are there any issues I should know about if I were to implement the language myself.

Also the sampleXml link doesn't work any more. Has it been moved or permanently deleted? Found the link for the generator part 6 here: http://confluence.jetbrains.net/display/MPSD1/Generator+User+Guide+Demo6

Thanks,

Ed

0
Comment actions Permalink

Hi!

I know this is an old thread but can I ask are you still planning to at some point release the Javascript language implementation in a build or will it remain internal only?

There is no decision concerning (currently internal) javascript language availability yet.. I'll try to reiterate a discussion concerning this language to be able to finally answer your question. :-)

I understand that MPS allows me to trivially implement this on my own but I have a feeling it could be relatively time consuming.

Well, it's not so time consuming.. But you are right - it make sense to wait till the final decision concerning JetBrains Javascript language availability. :-)

Also can I ask are there any reasons you haven't already released it either in the builds or as an additional language like you do here:

Mostly copyright questions and the necessary support routine.

0
Comment actions Permalink

Thanks for the response. I definately think more languages will help with the adoption of MPS if that helps at all. I'll keep my fingers crossed anyway since I am a big fan of so many of Jetbrain's products (Teamcity, Rubymine, PhpStorm) and MPS is definately something I will want to add to my toolkit in the near future (although the documentation does need a little work too).

Big thanks,

Ed

1
Comment actions Permalink

Any word on the release of the internal Javascript? Thank you!

2
Comment actions Permalink

It would be nice if you included Javascript as Netsuite, IBM, Salesforce have JS based apis that could help us ERP devs automate TONS of business! Thank you

0

Please sign in to leave a comment.