How to add a new primitive type Follow
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.
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.
Please sign in to leave a comment.
You can check IntegerConstant concept from the MPS base language.
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.
Its not here any more. Did you delete it?
So I couldn't have deleted comments from other peoples.
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?