My language should contain primitive data types, which are not part of java, for example unsigned int or bit. I added some normal concepts which extends the baselanguage Type concept. But now I want to setup the type system in MPS. I don't know how to specify a inference rule for this new types? There are these structure nodes of type primitive datatype. But I also don't know what to do with them, since they only have a name and nothing more.

Thanks! That's what I've already done. But I still don't know what this primitive datattype nodes good for?

My current type problem is, that I've added a subtype of baselanguages IntegerType. But I want this new type to be compatible with IntegerType, too. So I could assign a normal integer literal to my own IntType without a cast. Can you please tell me the proper way to define that? I've tried several things, but all lead to errors or to a wrong behavior.

If I create a declaration of baselanguages type int in my sandbox everything is fine, if I use bit instead I got a warning like Type x3 was not calculatedwheras x3 seems to be a random name which can't be found in my code and changes from statement to statement. So what else is necessary to build up a minimal surrounding for my own type? And how can I create a type which is completely independent to all java types?Magvay @ 3:37 am Our baseLanguage has primitive types such as byte or short. I think you can do it in the same way as in baseLanguage. Relations between this types are defined with subtyping rules (see byte_extends_short rule for example).

The subtype relation is not the problem. But in Java you can also write

short s = 4;

prettyPrint();
This isn't allowed in baselanguage, since 4 is of type int which is no subtype of short. So I can't see the solution to my problem in the baselanguage's code. Is there any way to allow such a relation without having a subtype loop?

I think sub-typing loop should not be a problem: you can create "weak" subtyping rule saying that IntegerLiteral with the 16-bit value is subtype of ShortType. Please try if this works in your use case.