Open C# Language Projects in MPS 3.2
Hi,
I'm trying to open 2 projects that seem to implement C# in MPS:
1. https://bitbucket.org/nesteruk/mps-c/downloads
2. https://code.google.com/p/mps-csharp/
Both of them were created with older version. When I try to open them MPS suggest to run Migration Assistant but after it finishes it looks like the project is empty - there is no structure nor editors or anything else.
Can someone help me understand how to open those projects?
Thank you,
Ido.
I'm trying to open 2 projects that seem to implement C# in MPS:
1. https://bitbucket.org/nesteruk/mps-c/downloads
2. https://code.google.com/p/mps-csharp/
Both of them were created with older version. When I try to open them MPS suggest to run Migration Assistant but after it finishes it looks like the project is empty - there is no structure nor editors or anything else.
Can someone help me understand how to open those projects?
Thank you,
Ido.
Please sign in to leave a comment.
I've up-voted your issue, because I'm also interested in implementing a C# language in MPS. I've also tried to open the project. Unfortunately, I got the following error message.
RuntimeException: java.lang.RuntimeException : java.io.IOException: Failed to create directory: C:..\nesteruk-mps-c-d5ed3f339d03\nesteruk-mps-c-d5ed3f339d03\CSharp3.mpr\_spreferences
I don't know what's the problem. Anyway, the plugin was created by a Jetbrains developer. Maybe someone here could give some hints.
Sorry for the late answer. I've been busy, lately.
I downloaded the MPS 1.5 version, which you can find here:
https://confluence.jetbrains.com/display/MPS/JetBrains+MPS+1.5+Download+Page
I tried to open the project with that version and it worked. :]
I guess there are some problems with the migration to new versions, but the detailed problem is unknown to me.
Maybe you could tell us/me what you want to do with the C# language.
I'll be happy to share my needs for MPS.
I'm responsible for developing SDK in several platforms, currently it is iOS, Android, Unity, Adobe AIR and Cordova. The SDK should be in-par between all platforms but native to each one. By native I don't mean just the language which is obvious I also mean that it will be clear to each developer of a platform how to use it. For example, registering and consuming events is very different between iOS, Android and Unity (C#). I can make Android with the same design of iOS but it will be very strange to iOS developer.
My plan is to create a high-level language in MPS in which I'll describe the parts of my SDK that tend to change frequently and then create model-generators for each language that translate the high-level language to language-specific-in-MPS and then use TextGen to generate source files.
Then I'll take those source files and copy them over a skeleton of each SDK. That way I'll be free to write native code in each SDK for the prats that are very different and usually not changing often and generate the parts that do change often.
I'll be happy to hear if someone else has done this and what other think about this direction.
Thank you,
Ido.
I've download and use MPS 1.5 to open the C# MPS language. First the Mac versions built for PowerPC and since I have Intel based Mac I can't use them. So I've download the Window version and use it in virtual machine and I'm sorry to say that as far as I can tell the C# implementation in very limited, there is only implementation of interfaces there, classes are not exactly implemented.
Thank you for your help but it seem this is a dead-end for C# MPS language, so I guess I'll have to write my own :)
Ido
yes you're right. The implementation is very limited. I've written with the creator of this language. He said that he don't know when he has time to continue this project. So that means we are on our own. :]
I've already started to implement some minor subset of C#, which fits my needs.
The whole language won't be written fast and also you have to consider so much constraints, which you have to implement on your own.
Is there any smarter way to convert this project to MPS 3.2 beside doing it manually?
I'm also looking for the very minimal implementation. I'm not afraid of writing code inside MPS that might be wrong. I'm not looking for MPS to be my C# editor.
Ido
You can check at least your generated C# code with two simpe commands in the cmd. If you want to, you can integrate it in your MPS workflow. Possibly you have to change the version number. Run cmd as administrator!
I'm also interested in C# as an MPS generation target language. I also found the older projects some months ago and finally migrated them successfully to the latest MPS version. Then I analyzed both the languages and the latest C# language specification. There were too many differences and so I started implementing my own C# language. I think there are two ways: We can either implement a well-designed MPS C# language with great editor support or we implement just the structure and a basic editor according to the EBNF grammar from the specification. I've chosen the latter because I just want to use the language as a target language for my generator. I also focused on the subset of language elements I need for the generation.
I think it would be great to have a plugin which automatically transforms an EBNF grammar into an MPS language but for now it seems that we have to implement it manually.
Regards,
LaAck
Do you have the rules for the .cs file generation defined in the textgen or generator aspect. If it's the generator aspect, how do you do it? I couldn't figure it out.
Regards
msch95
I implemented the structure, editor and textgen aspect for C#. The generator aspect is for transforming a model specified in one language to a model in a different or even the same language. This means that, if you want to transform e.g. a Java program to a C# program in MPS you make use of the generator aspect. If you want the text representation of your Java or C# program then you have to use the textgen aspect. The latter could also be called "serialization aspect".
I hope this helps. If not, don't hestitate to ask. :)
Regards,
LaAck
That's the answer I was hoping for.
Regards,
msch95
Can you please share with us the code of your language?
If you'll publish it on Github I'll be glad to try and collaborate on developing the language?
Thank you,
Ido.
I would be glad to share the language with you but it is not my decision. The reason is that I developed it in the course of my work. But since it is not the core feature of our DSL project, I will ask, if it is possible. The responsible person is currently on vacation so it may take one or two weeks.
Also I have to say that the language is "ok" for our generation purposes but probably not for yours and definitely not for implementing software in C#. One good feature is that I utilized the copy-paste functionality of MPS to avoid implementing the TextGen aspect. I just take a snapshot of what the user sees in the editor and use this for serialization.
Regards,
LaAck
I've developed a small subset of C#. For now I am able to write something like this in my MPS Sandbox:
I know that I can copy that code and paste it in Visual Studio. But am I able to do the opposite direction?
How do you meant that or rather how have you implemented it? It would be cool if I could write that above code in a .cs file.
I really appreciate your help and I'm really getting forward due to your answers.
Best regards
msch95
this small subset is also possible with my C# language. Good to know. :)
Regarding the copy-paste functionality I meant that I'm able to transform the C# model (e.g. your sandbox example in MPS) to text in a .cs file programmatically without defining a string representation for each concept. The opposite direction is also possible but hard to implement. A functionality like this is currently just available for Java, I think.
Regards,
LaAck
Interesting story..
I don't know if it's worth the effort of implementing such an import handler.
Possibly we work for the same company, but in different departments. I've written an email to your google and company mail (if it's you).
I appreciate your answer Bernd and I've seen such implementation for example in this video:
https://www.youtube.com/watch?v=1OrHUQ1anZg
This parser works with C, which is really great stuff. I (and possibly some others too) am also interested in getting such a parser for C# working.
However what's beyond my knowledge is if I have to define the whole C# language as a MPS language and write such an import handler, that extracts tokens from the C# code and inserts this into my custom C# language in MPS.
Am I right? I don't know whether there's an easier solution or not.
Because if I am right, the effort to bring such an C# code importer to MPS will be bigger than the profit.
Bernd, I'd be really grateful if you could give an answer to my brainstorming above.
Best regards
msch95
Obviously the constructs that you want to import have to be somehow present in MPS.
You can use an existing parser (just googled and found https://github.com/ChristianWulf/CSharpGrammar) and then use MPS APIs to map the grammar AST to the MPS AST. Given that you have already the subset of C# implemented in MPS that you want to import it is a relatively simple task which should not take that long. It is always a matter of how complex the input language is and how much of it should be supported. In our case a pure C import is rather trivial. The complexity comes from importing the preprocessor code as variants.
Best regards,
Bernd
Many thanks Bernd!
Yestrerday I read about that here:
https://mbeddr.files.wordpress.com/2010/06/tomassettiratiu-extractingvariabilityfromcandliftingittombeddr.pdf
Best regards,
msch95
https://github.com/CampagneLaboratory/ANTRL_MPS
We used the project to build copy/paste functionality for the R language into MPS (will be available in MetaR 1.5). Here's a tutorial:
https://github.com/CampagneLaboratory/ANTRL_MPS/blob/master/Tutorial.pdf
An ANTLR v4 grammar for C# can be found here: https://github.com/antlr/grammars-v4/tree/master/csharp (more recent and based on the one Bernd pointed to).
I had some time and tried your ANTRL-MPS plugin. I received a error message (pls see below), when pasting the ANTLR rules. I know that a macro misses. However, how can I fix this?
Thanks in advance!
Undefined macro: ANTLR_HOME fix...
FileNotFoundException: Unable to paste : ${ANTLR_HOME}\tree.ps
Really appreciate your help!