Using dates within MPS

Hi, I am currently evaluating MPS by creating a small business rules language in MPS. To support certain business rules, I require the use of dates within the language. I found that about 10 years ago there used to be some kind of dates language. I am currently using the Type language to have access to Strings and Primitive types. I would like to add dates to that if possible. The part which uses these types is as seen below:

Here I want to assign a datatype to an attribute of an entity, just like you would for example in SQL write something like:
Name Varchar(255) NOT NULL in a create table statement.

Does anyone have suggestions for adding dates to the PrimitiveTypes or Types language? And if so, can it be done with an existing language like the old dates language?

Thank you in advance for your help.
Kind Regards,



Hi Coen,

I realize that it has been a month since you have asked your question. Are you still looking for an answer? If yes, what are these PrimitiveTypes and Types languages that you mentioned?


Hi Sergej,


I believe PrimitiveTypes and Types are part of the MPS base language. I think MPS uses them for datatypes in their Java syntax. When I add a Type child to a concept, I can use the projectional editor to complete the component with values like int, string and double. Using these instead of creating something like an enumerator with datatypes has the advantage of already supporting type checking. This is important, because I want to use datatypes I assign to an attribute (see the first image of this post) in MPS expressions (Expression is I believe also part of the base language used for calculations).

These Types that the base language of MPS uses, are incomplete for my purposes. I want to eventually translate these datatypes to something similar to SQL code. This means datatypes like dates need to be added to my current project. 

There have been posts in the past mentioning a Dates language as a part of MPS, which would most likely serve my purposes for those datatypes. I would like to know if there is still such a language available somewhere, or if there is an alternative to adding datatypes similar to Type datatypes in the base language like a date.


Yes, there seems to have been a dates language, but I don't see it anymore. There is a blReference sample project (documented here) which contains a starting point for defining a custom date type for base language. It might be enough for you.

By the way, reusing BL concepts can be a good start but unless your DSL is supposed to remain closely tied to Java, consider defining your own concepts for types, to avoid bringing in unnecessary baselanguage baggage with its concepts. Same applies to expressions.


Please sign in to leave a comment.