📜 ⬆️ ⬇️

JetBrains MPS for those interested # 2

Yo-ho-ho!


In the last post, we stopped at the fact that we are able to add an array of input weather data, or rather, Time + Temperature data, tried to use Behavior and dealt with the concepts.


It's time to do something useful, because while everything we implemented could be implemented in any other language, with the exception of cool syntax.


First of all, we introduce time limits. Now we will limit it so that the clock is in the limit of 0-24, and minutes are 0-60, otherwise a compilation error will be issued.


Constraints


Constraints is an aspect of the language that is responsible for the validity of the concept implementation. In our case, we need to restrict the property hours and minutes, so we create the Constraints aspect of the Time concept.


image


Here we see 3 points that are responsible for the structure of the AST.


Source: https://habr.com/ru/post/334376/


All Articles