Replies: 6 comments 1 reply
-
Maybe an attribute (#756) would be appropriate for those? |
Beta Was this translation helpful? Give feedback.
-
I don't think we currently have a syntax similar to your proposal. What immediately comes to my mind is the Is it possible to combine initial with continue or reset? I mean something link this I really like @oowekyala's suggestion as it is flexible and easily extendable. Also, attributes can be chained if that is needed ( |
Beta Was this translation helpful? Give feedback.
-
Generally, I always like to be able to read programming constructs as if they were prose. In that light, I would say it is more natural to write When it comes to the labeling of initial states, I think that either maintaining the |
Beta Was this translation helpful? Give feedback.
-
I agree with @lhstrh about not being shy about reserving keywords. Right now, our user community is small, so the pain of introducing new keywords won't be big (mostly we just have to modify a few tests). I'm hoping that situation won't last very long, though, so if we are going to reserve keywords, it's much better to do it sooner rather than later. |
Beta Was this translation helpful? Give feedback.
-
I really like the proposal of @lhstrh with the transition type first, also in regard of the interleaved syntax. I adjusted my PR accordingly. Regarding the annotation syntax, I am a bit reluctant. Personally, I often perceive annotations as of lesser importance (e.g. |
Beta Was this translation helpful? Give feedback.
-
I initially thought that I also think that @lhstrh's suggestion would be a good solution for marking reset and continue transitions. |
Beta Was this translation helpful? Give feedback.
-
With modal reactors four new keywords were introduced: mode, initial, reset, continue. Since these then could no longer be used for other ids, such as variable names, it caused a few problems with existing models. This raised concerns for introducing new keywords, especially common ones, such as reset.
Current Implementation in Modal Reactors
The mode keyword is essential for the parsing process, hence, there is no way around it but there were no models using it anyway.
reset and continue were initially an enum rule in the grammar. However, reset is used rather often as an input port in Savia benchmark models. Hence, I implemented @petervdonovan's idea and replaced the predefined enum filed by a string. As a consequence the grammar accepts any input at this location but with additional validator rules, code completion proposals, and semantics syntax highlighting, the old keyword behavior could be simulated. In contrast to the initially proposed syntax for mode transition effects on reactions, the transition modifier is now in parentheses to ease parsing:
The initial keyword could be implemented as a string as well, however, since it represents a boolean value and is currently located before the mode keyword, which is relevant for the parser look ahead (
(initial?='initial')? 'mode'
), I am not sure if it is beneficial to do this. Hence, initial remains a keyword for now. As a consequence, one existing model had to be adjusted, as well as a target property.Discussion Topics
Beta Was this translation helpful? Give feedback.
All reactions