I want to define grammar in Xtext for the state machine. My rule is that one state machine must have [1.. * ] transitions, [1..1] initial state, [1..1] final state, and [0.. * ] intermediate states.
StateMachine:
'InitialState' initialstate = InitialState
'FinalState' finalstate = FinalState
'States' '{' states+=State* '}'
'Transitions' '{' transitions+=Transitions ( "," transitions+=Transitions)* '}'
;
This is how I have written the rules but when I generate the ecore model, I notice that the relation of the initial state and final state with the state machine is [0..1] and not [1..1] as I wanted it, and the relation between transition and statemachine is [0.. * ] and not [1..*]. Can you help me find out where I went wrong?
Thank you