Where to get the 'type' of an Expression from?

Hi,

I'm currently going through the MPS Basics screencast, episode 2 (http://tv.jetbrains.net/videocontent/mps-basics-enhancing-the-language-of-constants), but I get stuck at around 08:54 when the expression "node.initialiazer.type" is used in a COPY_SRC macro. Apparently MPS is not able to find the 'type' property for an Expression (baseLanguage). How can types be accessed, if not like shown in the screencast?

Thanks!

Cheers,

phil
6 comments
In this case, "type" is not a property, but a call of the typesystem engine returning the node describing the type of an expressions (all types in MPS are represented by nodes, same to AST ones).
Though I haven't tried the screencast, I suppose you don't have the typesystem language imported. All you need to do in this case is to press ctrl-L, type "typesystem" and choose the typesystem language. The .type operation should then appear.

Regards,
Mihail
0
Hi,

tried as you suggested, but still, no 'type' operation to access. I also just downloaded the newest release from the homepage, redid the tutorial, tried to add the typesystem language via Ctrl+L, which again did not work (I had to do it via the Module Properties). Again, the 'type' operation was no accessible. Are there any issues with 64bit Linux and MPS?

Thanks!

Regards,

phil
0
Now real strange things happen. I again downloaded the latest release, deleted the hidden MPS dir in my home folder an restarted again from scratch with the above screencast (Constants language). No I even can't use Expression anymore, as is done in episode two; baseLanguage is listed as a dependency, the model build works, however, if creating a solution, and adding a new Constant I always get the error "Error in children role "initializer" (declared cardinality is 1)" although I type "MyConstant MyName : 1" which should work according to the tutorial. I'm working on:

Fedora Core 17, 3.5.4-1.fc17.x86_64
java version "1.7.0_06-icedtea"
OpenJDK Runtime Environment (fedora-2.3.1.fc17.2-x86_64)
OpenJDK 64-Bit Server VM (build 23.2-b09, mixed mode)

Thanks for any help!

Cheers,

phil
0
So i tried the Calculator tutorial, which also uses expression, and interestingly, it worked. However, the difference to the other screen-cast (Constants language) is, that for the Calculator in case of adding the baseLanguage a different process is chosen (added as an extended language and also to the solution!) which in contrast to the screen-cast for the Constants language is not done nor mentioned at all. There, it is only mentioned to add baseLanguage to the Module dependencies, which actually, does not do the job. Now also adding typesystemLangauge as an extended language resolves the problem of accessing the .type operation.

What exactly is the difference between dependencies and extended languages? As this somehow also seems to confused in the screen-casts (or at least used for the same purpose in different screen-casts, but somehow only works in some way), some clarification would help!

Thanks a lot!

Cheers,

phil
0
Adding extended language (l2) briefly means that at least one of original language (l1) concept is either extending the concept from that language (l2) or aggregates it. In case you are just using constructions of another language (like you do with .type operation) you have to add this language to a set of used languages.

If you recently upgraded MPS then you can try to create new project and new language in it and repeat all tutorial steps there. Dependency logic was changed a bit in MPS 2.5 and it's necessary to migrate legacy projects in order to make them valid. Obviously it doesn't make sense to migrate sandbox projects created while passing tutorial - you just have to repeat all steps in a new (major) version of MPS.

Please file bug report in case you still can't import language and pass the tutorial.
0
Hi Alex,

thanks for clearing this up. In the meantime, I was able to do the tutorial without any problems. The above mentioned problem did no occur again.

cheers,

phil
0

Please sign in to leave a comment.